I have this message loop in my program:
while (true) { if (PeekMessage(&msg, window, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { MessageBox(NULL, L"Quit", L"", 0); break; } TranslateMessage(&msg); DispatchMessage(&msg); } else { Render(); } }
This cycle never ends. It never displays a message box, even if the main window disappears. Here is the WndProc code:
switch (msg) { case WM_CLOSE : DestroyWindow(hwnd); break; case WM_DESTROY : PostQuitMessage(0); break; default : return DefWindowProc(hwnd, msg, wParam, lParam); break; } return 0;
Can someone please help me? I literally stretch my hair.
source share