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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| #include <windows.h>
#include <stdio.h>
#include "resource.h"
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
BOOL APIENTRY DlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
HINSTANCE hInstance;
HWND hWnd;
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
HWND hWnd;
MSG messages;
WNDCLASSEX wincl;
hInstance = hThisInstance;
// Infos importantes
wincl.hInstance = hThisInstance;
wincl.lpszClassName = (LPWSTR)"Classe principale";
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
// Icones et curseurs par défaut
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
RegisterClassEx (&wincl);
hWnd = CreateWindowEx (
0,
(LPWSTR)"Classe principale",
(LPWSTR)"Titre",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
544,
375,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage (&messages);
DispatchMessage (&messages);
}
UNREFERENCED_PARAMETER (hPrevInstance);
UNREFERENCED_PARAMETER (lpszArgument);
UNREFERENCED_PARAMETER (nFunsterStil);
return (int)messages.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CHAR:
DialogBox (hInstance, (LPWSTR)"Dialog", hwnd, (DLGPROC)DlgProc);
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
BOOL APIENTRY DlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_COMMAND:
EndDialog (hwndDlg, 0);
break;
default:
return FALSE;
}
UNREFERENCED_PARAMETER (wParam);
UNREFERENCED_PARAMETER (lParam);
return TRUE;
} |
Partager