(window) Windows. , . , . : , (MDI), , . , . (Title, Caption), Handle ( HWND)
(Window Class) . ( , , ), ( DLL, , ) ( ). . , , .
RegisterClass() RegisterClassEx(), CreateWindow() CreateWindowEx().
(Window Procedure WndProc) , . switch case, :
LRESULT CALLBACK
MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case M_CLOSE: //
DestroyWindow(hWnd);
break;
case WM_DESTROY: //
PostQuitMessage(0);
break;
case
break;
default: //
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}
. , .
(Window Message) . , , , . MSG, : , wParam, lParam, , ( ).
, . , . SendMessage(). , .
, , . PostMessage(). , , , SendNotifyMessage(), , , .
|
|
. , :
MSG msg;
while (GetMessage(&msg,NULL,0,0)) //
{
TranslateMessage(&msg); //. ()
DispatchMessage(&msg); //
}
, GetMessage() .
GetMessage() . , MSG. WM_QUIT, . .
Windows :
1) WinMain() ;
2) ;
3) RegisterClass() ;
4) CreateWindow() ( , ;
5) ShowWindow(), UpdateWindow() ;
6) : GetMessage() TranslateMessage() DispatchMessage().
7) , ;
8) , , (callback) .
1. , .
2. . .
3. .
4. .
5. UpdateWindow() ShowWindow().
6. Windows (Win Message), . .
7. .
8. , GetMessage(), .
9. TranslateMessage(), DispatchMessage().
10. , .
11. WM_PAINT. , .
12. WM_COMMAND. , wParam lParam .
11. .
12. GetWindowRect() InvalidateRect().
13. . . .
, . Start Stop. Start . Stop , Start . WM_PAINT .
7
:
1) ;
2) ;
3) .