Link to home
Start Free TrialLog in
Avatar of Aleq
Aleq

asked on

Set HOOK to local method

I'm creating a component, that must process parent's messages. I would like to use hooks, but I don't know, how to set hook to local (component's) method ...

function Mycomponent.MessageHookProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): lResult stdcall;
begin
Ā ......
end;

constructor Mycomponent.create(AOwner : TComponent);
begin

SetWindowsHookEx(WH_CallWndProc, MessageHookProc, 0, GetCurrentThreadId);

end;

Global method is not a solution, since the method is only one and I will have more than one instances on different forms. Any Hint ? thanx
Avatar of Aleq
Aleq

ASKER

Or else - I need to catch form's events from my component which user puts on this form.
When you say events, do you mean windows messages, or things like OnClick etc...

Cheers,

Raymond.
ASKER CERTIFIED SOLUTION
Avatar of rpo
rpo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleq

ASKER

Wow ! It looks very promising.
I'll try it ASAP
Avatar of Aleq

ASKER

Wow ! It looks very promising.
I'll try it ASAP