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

相關文章
相關標籤/搜索