Unit HookInst

------------------------------------------------------------------------------ HOOK METHOD INSTANCE // These few lines of code implement for windows hooks what MakeObjectInstance and FreeObjectInstance do for windows message functions. They allow a method to be written and passed into the SetWindowsHookEx API function rather than a stand alone function which cannot directly access variables or methods. // An example of use is in the IDE Peek expert. // The code is based entirely on the MakeObjectInstance and FreeObjectInstance in the Delphi Forms unit. In fact my only input has been to change a few names and make it work for Hook calls rather than Message calls. So I don't claim a lot. Borland's ownership of this code is recognised and I hope noone there minds my borrowing it and bodging it for this purpose! // This way of writing a hook function is a bit wasteful of memory for what you are doing (but hell, what's 4KB nowadays!, this isn't a Z80 and CPM). // Only tested under Delphi 3.02 // Version 1.00 5-2-98 Grahame Marsh // Freeware - you get it for free, I take nothing, I make no promises! // Please feel free to contact me: grahame.s.marsh@courtaulds.com ------------------------------------------------------------------------------

Classes

Functions

FreeHookInstance - Free a hook method instance
MakeHookInstance -

Types

THookCall
THookMethod

Constants

Variables


Functions


procedure FreeHookInstance (ObjectInstance: pointer);

Free a hook method instance

function MakeHookInstance (Method: THookMethod): pointer;


Types


THookCall = record
Code : integer;
WParam : WPARAM;
LParam : LPARAM;
Result : LResult
end;

THookMethod = procedure (var HookCall: THookCall) of object

Constants


Variables