Having such a simple Win application:
bool continueRunning = true;
...
int APIENTRY wWinMain(...) {
while (continueRunning) {
PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
TranslateMessage(&msg);
DispatchMessage(&msg);
if (WM_DESTROY == msg.message) {
OutputDebugString(L"--- WM_DESTROY (WinMain) ---\n");
}
}
}
...
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
switch (message) {
case WM_DESTROY:
OutputDebugString(L"--- WM_DESTROY (WndProc) ---\n");
continueRunning = false;
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
I got --- WM_DESTROY (WndProc) ---
message but not --- WM_DESTROY (WinMain) ---
.
How does the message WM_DESTROY
is passed to the app since the PeekMessage
doesn't get it?