我将此代码用于主循环(我的函数):
while (running)
{
if(is_close)
{
Log().push_log("close", "message close!", logInfo);
running = active = false;
break;
}
while (PeekMessage(&msg, g_hWnd, 0, 0, PM_REMOVE))
{
std::cout << "Wnd: " << msg.message << std::endl;
if (msg.message == WM_QUIT || msg.message == WM_DESTROY || msg.message == WM_CLOSE)
{
MessageBox(0, "Hello, World", "Hello", MB_OK);
running = false;
}
// TranslateMessage(&msg);
DispatchMessage(&msg);
}
if (running && active)
render.DrawObject(g_hDC);
}
Run Code Online (Sandbox Code Playgroud)
那么,我使用WndProc:
LRESULT CALLBACK GLWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
std::cout << "Wnd Proc: …Run Code Online (Sandbox Code Playgroud)