formhook OnMessageBefore event
OnMessageAfter Example
Return to Introduction  Previous page  Next page
Applies to
acFormHook component.  

  TacWndProcMessageBeforeEvent = procedure(Sender: TObject; var Message: TMessage; var Handled: Boolean) of object;  
property OnMessageBefore: TacWndProcMessageBeforeEvent;  

The OnMessageBefore event occurs when acFormHook component hooks the message (WM_xxx) for this window, before message passes to the default procedure handler.  
Write the OnMessageBefore event handler to hook all windows messages (WM_xxx) sent to this form, before their processing by default message handler (CallWindowProc API routine).  
If you have processed this message and do not want to pass it to default message handler, set Handled parameter True.  

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.  

See also
OnMessageAfter event and small example how to hook windows messages.