Class TMessageGrabber (unit MessageGrabber)

Inherits from

TComponent

Constructors


constructor Create(AOwner:TComponent);

Create: Override the WndProc of the owner window.


Functions

destructor Destroy;

Destroy: Removes the overriding window handler

procedure DefaultHandler(var Msg);

DefaultHandler: The Dispatch method will attempt to dispatch the method, and failing will call DefaultHandler.

procedure WMDestroy(var Msg:TWMDestroy);

WMDestroy: If WM_Destroy is sent to the owner, then when we get around to calling the Destroy method here, Owner will no longer be valid.

procedure WndProc(var Msg:TMessage);

WndProc: For windowed controls, standard message handling is: the message is sent to WndProc, which calls Dispatch.

Properties

Events

Variables

MyWndProc : TFarProc;


OwnerProcGrabbedQ : Boolean;


OwnerWndProc : TFarProc;



Constructors


constructor Create(AOwner:TComponent);

Create: Override the WndProc of the owner window. Note that it will be a very bad idea to have several MessageGrabber components active at the same time, unless they are added and removed carefully in order


Functions


destructor Destroy;

Destroy: Removes the overriding window handler


procedure DefaultHandler(var Msg);

DefaultHandler: The Dispatch method will attempt to dispatch the method, and failing will call DefaultHandler. If a message-response method calls its inherited method, where the inherited method is undefined, the message is also sent to the DefaultHandler. For a TMessageGrabber, DefaultHandler should pass any unhandled messages back to the owner


procedure WMDestroy(var Msg:TWMDestroy);

WMDestroy: If WM_Destroy is sent to the owner, then when we get around to calling the Destroy method here, Owner will no longer be valid. So, there are two cases: Destroy is called without WMDestroy (ie component is removed at design-time) and WMDestroy is called first (ie owner is about to be destroyed


procedure WndProc(var Msg:TMessage);

WndProc: For windowed controls, standard message handling is: the message is sent to WndProc, which calls Dispatch. Only windows controls have a WndProc. But Dispatch is a method of TObject, used for dispatching all message-based methods, not just Windows ones. This WndProc mimics that of a windowed control


Properties


Events


Variables


MyWndProc : TFarProc;


OwnerProcGrabbedQ : Boolean;


OwnerWndProc : TFarProc;