Your message loop retrieves and sends messages for all windows created in the current thread.
A simple message loop like this will suffice.
MSG msg;
while(GetMessage(&msg,0,0,0,0)>0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
, , CreateWindow (...) , / .
. , , WM_DESTROY WindowProc PostQuitMessage(). PostQuitMessage() , . , . , , , , PostQuitMessage. ( ) , , PostQuitMessage , .
, , , , , IS .
Windows :
while(GetMessage(&msg,hwnd,0,0,0)...
, . /. , , , , NULL hwnd, , , , - .