// A WM_* message is available.// If a parent child relationship exists between windows across threads// then their thread inputs are implicitly attached.// This causes the MsgWaitForMultipleObjectsEx API to return indicating// that messages are ready for processing (Specifically, mouse messages// intended for the child window may appear if the child window has// capture).// The subsequent PeekMessages call may fail to return any messages thus// causing us to enter a tight loop at times.// The WaitMessage call below is a workaround to give the child window// some time to process its input messages.MSGmsg={0};DWORDqueue_status=GetQueueStatus(QS_MOUSE);if(HIWORD(queue_status)&QS_MOUSE&&!PeekMessage(&msg,NULL,WM_MOUSEFIRST,WM_MOUSELAST,PM_NOREMOVE)){WaitMessage();}