SendMessage 与 PostMessage

先看MSDN的解释:windows

SendMessage:函数

The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.post

SendMessage函数将指定的消息发到窗口。它调用特定窗口的窗口处理函数,而且不会当即返回,直到窗口处理函数处理了这个消息。spa

 

PostMessage:线程

The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.队列

PostMessage函数将一个消息放入与建立这个窗口的消息队列相关的线程中,并马上返回不等待线程处理消息。ci

 

SendMessage所发送的消息是会调用WndProc,等待WndProc处理消息并返回后它才返回。消息队列

PostMessage是向指定的窗口的线程的消息队列中发送当前的消息,而且当即返回。it

相关文章
相关标签/搜索