appevents OnMessage event
Example
Return to Introduction  Previous page  Next page
Applies to
acAppEvents component.  

Declaration
type  
  TMessageEvent = procedure(var Msg: TMsg; var Handled: Boolean) of object;  
 
property OnMessage: TMessageEvent;  

Description
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 doesn't 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.  
 
The TMessageEvent type is the type of the OnMessage event. The Msg parameter identifies the Windows message, and the Handled parameter indicates whether the event handler responded to the message. Set Handled to True if the message has been completely handled, to prevent subsequent processing of 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
iiwarning 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.