Programmer Question
Typically, the window procedure for a "main" window class would call PostQuitMessage in response to a WM_DESTROY message.
I would prefer to have the main thread decide when it wants to terminate based on the lifespan of the window(s) it creates. This way, whatever window class I choose to be the main window can have a generic window procedure that doesn't have PostQuitMessage in it.
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if(msg.hwnd == hWnd && msg.message == WM_DESTROY)
{
PostQuitMessage(0);
}
}
The above is my attempt, but the WM_DESTROY message is never posted to the message queue, it seems to be internal to the window procedure.
Is there some way to accomplish this?
Find the answer here
No comments:
Post a Comment