Link to home
Start Free TrialLog in
Avatar of bryan7
bryan7Flag for Japan

asked on

Keyb Hooks LIST

How can I retrieve a list of keyboard hooks
installed and the respective applications who
called them ?
Avatar of Lee_Nover
Lee_Nover

create a system debug hook with SetWindowsHookEx with WH_DEBUG

in the DebugProc check if it's a keyboard hook
if wParam = WH_DEBUG then begin
...
check the DEBUGHOOKINFO for idThreadInstaller
that's the thread that installed the hook

getting the application of the thread that installed the hook is another thing
it could even be installed from within a thread created in a dll function which was called from some app :)
about getting the list .. simply add a hook each time you get notified of one
ofcourse check if it's in the list already
I'm assuming you know about system hooks so I won't code it for ya now
if wParam = WH_DEBUG then begin

darn .. that should've been
if wParam = WH_KEYBOARD then begin
...
Avatar of bryan7

ASKER

Hello, thanks for the answer.. however I'm not
that good on hooks ;( I can make a system key hook
in a dll but that's all my knowledge about hooks =(

Can you make the code for me ? I need it to get the list
of all currently set keyboard hooks, I'll add more points
if you wish... I really need this app.

btw, if you know of an already made application that
does that (no need for source) I'll give you the points
too :)

Thanks.
don't know of such an app
I'll write the code as it's not that much work
when I wake up :)
ASKER CERTIFIED SOLUTION
Avatar of Lee_Nover
Lee_Nover

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 bryan7

ASKER

Hello, thanks for the code, I've been
trying to implement the app to get the
list from the dll with no succes :(
would you mind making it for me ? I
can add more points as wished :)

(you'll get A graded)
listening
:)
in my spare time ... today/tomorrow
Avatar of bryan7

ASKER

:)
listening
sorry I was away for a "few" days ...
have you got it working ? if not I'll make a sample app to show you how to use that dll
Avatar of bryan7

ASKER

haven't got it running yet,
would be nice if you could
make that app :)

thanks.
ok I will :)
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from Lee_Nover

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
humz ..
if anybody needs a List that's shared between processes then check out my TGlobalList ;)
http://www.siwww.net/Delphi/GLTest.zip

just change the TGLItem to fit your needs
it must not contain any pointer type fields !
for strings use a fixed length array of char

it already includes locking mechanisms so it's completely thread/process safe ;)