Vcl.Forms.TApplication.OnMessage

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnMessage: TMessageEvent read FOnMessage write FOnMessage;

C++

__property TMessageEvent OnMessage = {read=FOnMessage, write=FOnMessage};

Properties

Type Visibility Source Unit Parent
event public
Vcl.Forms.pas
Vcl.Forms.hpp
Vcl.Forms TApplication

Description

Occurs when the application receives a Windows message.

Use OnMessage to trap any or all Windows messages posted to all windows in the application. The OnMessage event occurs when an application receives a Windows message. An OnMessage event handler allows an application to respond to messages other than those declared in the events for TApplication. If the application does not have a specific handler for an incoming message, the message is dispatched to the window for which it was intended, and Windows handles the message.

Note: OnMessage only receives messages that are posted to the message queue, not those sent directly with the Windows API SendMessage function.

Caution: Thousands of messages per second flow though this event. Be careful when coding the handler, because it can affect the performance of the entire application.

Note: You can also respond to this event using the TApplicationEvents component, which allows you to assign an event handler using the IDE.

See Also

Code Examples