[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'InterfaceBase' (#lcl)

TWidgetSet.SendMessage

Sends a message to a window.

Declaration

Source position: winapih.inc line 237

public function TWidgetSet.SendMessage(

  HandleWnd: HWND;

  Msg: Cardinal;

  WParam: WPARAM;

  LParam: LPARAM

):LRESULT; virtual;

Arguments

HandleWnd

  

The handle of the target window.

Msg

  

The message ID.

WParam

  

Message parameter.

LParam

  

Message parameter.

Function result

The result depends on the message type.

Description

Remark: This section was copied from LCLIntf, and may not apply to all platforms.

This method is a thread-safe solution to send messages to windows.

The messages will be handled in the message loop of the application and therefore can be sent from any thread. They are not immediate, but they will awake the main thread if it is waiting for messages.

Custom messages should always have an ID higher than the constant LM_USER.

The two parameters WParam and LParam will be passed to the message handler, together with the message ID.

The difference between SendMessage and PostMessage is the way that they return control to the calling thread. With SendMessage, control is not returned until the target window has completed processing the message. With PostMessage, control is returned immediately.

See also

TWidgetSet.PostMessage

  

Sends a message to a window, without waiting for the message result.


Version 4.0 Generated 2025-05-03 Home