// Main message loop
MSG msg;
ZeroMemory( &msg, sizeof( msg ) );
while(msg.message!=WM_QUIT)
{
if(PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
Render();
}
}
“渲染”函数尚未执行
最佳答案
PeekMessage
文档中关于返回值的说明如下:
If a message is available, the return value is nonzero.
If no messages are available, the return value is zero.
当消息队列为空时,确实会返回零,即FALSE
。因此结论是消息队列永远不会为空。最可能的解释是,您在 DispatchMessage
中处理的消息之一会导致将同一消息发布到队列中。
关于winapi - 为什么 PeekMessage 总是返回 TRUE?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9759001/