while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage( &msg);
DispatchMessage( &msg);
}//消息循环不是每个时刻都有消息到达,那么GetMessage(...)会返回吗?返回0还是非0?还是会阻塞?顺便问问阻塞这个概念怎样理解?我是新手,还望各位不吝指教!
{
TranslateMessage( &msg);
DispatchMessage( &msg);
}//消息循环不是每个时刻都有消息到达,那么GetMessage(...)会返回吗?返回0还是非0?还是会阻塞?顺便问问阻塞这个概念怎样理解?我是新手,还望各位不吝指教!
Because the return value can be nonzero, zero, or -1, avoid code like this:while (GetMessage( lpMsg, hWnd, 0, 0)) ...The possibility of a -1 return value means that such code can lead to fatal application errors. Instead, use code like this:ExampleBOOL bRet;while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
没消息就不返回返回0还是非0?
WM_QUIT才返回0,还有...还是会阻塞?
堵塞,用PeekMessage就不堵塞顺便问问阻塞这个概念怎样理解?
-------
是该GUI线程被阻塞,而不是进程