SendMessage

  LRESULT SendMessage(hwnd, uMsg, wParam, lParam)    
  HWND hwnd; /* handle of destination window */
  UINT uMsg; /* message to send */
  WPARAM wParam; /* first message parameter */
  LPARAM lParam; /* second message parameter */

The SendMessage function sends the specified message to the given window or windows. The function calls the window procedure for the given window and does not return until the window procedure has processed the message. This is in contrast to the PostMessage function, which posts a message to a thread's message queue and returns immediately.

Parameters

hwnd

Identifies the window whose window procedure will receive the message. If this parameter is 0xFFFFFFFF, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows.

uMsg

Specifies the message to be sent.

wParam

Specifies additional message-dependent information.

lParam

Specifies additional message-dependent information.

Return Value

The return value specifies the result of the message processing and depends on the message sent.

Comments

If the given window was created by the calling thread, the window procedure is called immediately as a subroutine. If the given window was created by a different thread, Windows switches to that thread and calls the appropriate window procedure.

See Also

InSendMessage, PostMessage, SendDlgItemMessage