The thread to which the message is posted retrieves the message by calling the GetMessage or PeekMessage function. The hwnd member of the returned MSG structure is NULL.
while (::GetMessage(&msg, NULL, 0, 0)) { if (msg.message == WM_QUIT) { return 0; }
{
if (msg.message == WM_QUIT)
{
return 0;
}
// DispatchYourMessage(&msg);
}