UINT ThreadFunc(LPVOID lpParam) //线程函数
{
int bRet = 0;
MSG msg;
while(true)
{
if ((bRet = PeekMessage(&msg,NULL ,0,0,PM_REMOVE)) != 0)//Peek不阻塞,如果使用GetMessage会阻塞
{
// handle the error and possibly exit
if (msg.message == WM_USERMSG)
{
MessageBox(NULL, "receive from main thread", "", MB_OK);
}
else if (msg.message == WM_CLOSE)
{
return 0;
}
}
//todo something
}
return 0;
}
08-07
1937

被折叠的 条评论
为什么被折叠?



