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
| #include <windows.h>
LRESULT CALLBACK MainProc(HWND Dlg,UINT message,WPARAM wParam,LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX principale;
principale.cbSize=sizeof(WNDCLASSEX);
principale.style=CS_HREDRAW|CS_VREDRAW;
principale.lpfnWndProc=MainProc;
principale.cbClsExtra=0;
principale.cbWndExtra=0;
principale.hInstance=hInstance;
principale.hIcon=LoadIcon(NULL,IDI_APPLICATION);
principale.hCursor=LoadCursor(NULL,IDC_ARROW);
principale.hbrBackground=reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
principale.lpszMenuName=NULL;
principale.lpszClassName="std";
principale.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
RegisterClassEx(&principale);
HWND hWnd;
hWnd=CreateWindowEx(
WS_EX_CLIENTEDGE,
"std",
"Notre fenêtre",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(hWnd,SW_SHOW);
MSG msg;
while(GetMessage(&msg,NULL,0,0)==TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK MainProc(HWND hWnd, UINT mes, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
PAINTSTRUCT paintst;
switch (mes)
{
case WM_PAINT:
hDC=BeginPaint(hWnd,&paintst);
EndPaint(hWnd,&paintst);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, mes, wParam, lParam);
}
} |