这个非常简单的事情去,你想把消息交给窗口,那一定要指定是哪个窗口,也就是说要指定窗口句柄啊,
BOOL PostThreadMessage( DWORD idThread,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
这个函数无法指定你发送给哪个窗口,当然就接收不到啊,
也就是比你SendMessage的时候,多了一个idThread少了hwndWindow啊。
所以可以得出,PostThreadMessage发送的消息,窗口无法接收到的,而且,这个说明,在MSDN上面讲得非常的详细,具体
Messages sent by PostThreadMessage are not associated with a window. As a general rule, messages that are not associated with a window cannot be dispatched by the DispatchMessage function. Therefore, if the recipient thread is in a modal loop (as used by MessageBox or DialogBox), the messages will be lost. To intercept thread messages while in a modal loop, use a thread-specific hook.