|
|
Bonjour,
je suis en train de developper un dialog box que je n'arrive pas à récupérer son texte je veux bien que vous m'aider. Voilà mes codes:
############
#main.cpp
############
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "main.h"
using namespace std;
BOOL CALLBACK OutputSelectProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static char *text;
switch (msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case ID_OK:
{
GetWindowText(GetDlgItem(hwnd,IDC_EDIT1), text, 1024));
printf("text: %s\n", text);
EndDialog(hwnd, (void *)text);
break;
}
case ID_CANCEL:
{
EndDialog(hwnd, -1);
break;
}
}
return TRUE;
}
case WM_CLOSE:
{
EndDialog(hwnd, -1);
return TRUE;
}
}
return FALSE;
}
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int text = DialogBox(hInstance, MAKEINTRESOURCE(IDD_OUTPUTSELECT), GetDesktopWindow(), OutputSelectProc);
printf("votre texte est : %p\n", text);
printf("Tapez une touche pour quitter ...");
getch();
return 0;
}
#############
#main.h
#############
#define IDD_OUTPUTSELECT 102
#define IDC_EDIT1 103
#define ID_CANCEL 204
#define ID_OK 205
##############
#main.rc
##############
#include "main.h"
#include <windows.h>
IDD_OUTPUTSELECT DIALOG DISCARDABLE 0, 0, 187, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select your output"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK", ID_OK,130,7,50,14
PUSHBUTTON "Cancel", ID_CANCEL,130,24,50,14
EDITTEXT IDC_EDIT1,29,48,121,16,ES_AUTOHSCROLL
END
###################
j'attends vos réponses le plus tôt possible car j'ai vraiment besoin de ce code.
Merci d'avance.
|