SendMessage

From aldeid
Jump to navigation Jump to search

Description

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

To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.

Syntax

LRESULT WINAPI SendMessage(
  _In_ HWND   hWnd,
  _In_ UINT   Msg,
  _In_ WPARAM wParam,
  _In_ LPARAM lParam
);

Parameters

hWnd [in]
Type: HWND
A handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST ((HWND)0xffff), the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.
Message sending is subject to UIPI. The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.
Msg [in]
Type: UINT
The message to be sent.
For lists of the system-provided messages, see List of Windows Messages.
wParam [in]
Type: WPARAM
Additional message-specific information.
lParam [in]
Type: LPARAM
Additional message-specific information.

Return value

Type: LRESULT

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