65,186
社区成员




MSG msg;
bool bRet;
while((bRet = GetMessage(&msg,hWnd,0,0)) != 0)
{
if(bRet == -1)
{
return -1;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
MSG Msg;
while(GetMessage(&Msg,NULL,0,0))//NULL表示接受调用线程的所有消息
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);//将消息传递给了窗口过程去处理
}
if(hWnd == NULL)
{
MessageBox(NULL,"创建窗口失败",NULL,0);
return 1;
}
现在问题解决了,我把while((bRet = GetMessage(&msg,hWnd,0,0)) != 0)这段代码中的hWnd置换为NULL,
窗口关闭后,进程也正常关闭了!请问原因是什么?