1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
*** dans la fonction principale de la DLL:
this->hInstance = GetModuleHandle(NULL);
WNDCLASS wc;
wc.style = 0 ;
wc.lpfnWndProc = pFonction;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = NULL;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = pClassName;
// enregistre la fenêtre d'attente
if(!RegisterClass(&wc)) return( false );
// création de la fenêtre
this->hWindows = CreateWindow( pClassName, CST_FEN_TITRE, WS_BORDER | WS_POPUP | WS_VISIBLE,
x, y, width, height, NULL, NULL, this->hInstance, NULL );
if (!this->hWindows) return( false );
// affichage de la fenêtre d'attente
ShowWindow(this->hWindows, SW_SHOW);
*** dans le message WM_CREATE:
this->hParent = hwnd (passé à la fonction MainWndProc (pFonction), contenant le "switch case" des messages)
// création d'un message simple
this->hMess = CreateWindow(_T("edit"), _T(""),
WS_CHILD | WS_VISIBLE | ES_WANTRETURN | ES_MULTILINE | ES_READONLY | ES_CENTER,
0, 30, this->width, this->height-30, this->hParent, NULL, this->hInstance, NULL); |
Partager