So I can set a global low level keyboard hook from within a DLL pretty easily, but does it actually load that DLL into every process? How is it then, "Global" ?

Any useful insight into the way this works?

I use the command line program "tasklist" with the /M option to view loaded .DLLs and I don't even see the global hook DLL loaded in my app.

Something strange going on?

Also I might be statically linking to the DLL...

Edited 4 Years Ago by pseudorandom21: n/a

SetWindowsHookEx has the following parameter

[in] HINSTANCE hMod

This MUST be the module handle of the DLL within which the Keyboard procedure is defined.
There is another item in the remarks of SetWindowsHookEx documentation.

Before terminating, an application must call the UnhookWindowsHookEx function to free system resources associated with the hook.

This implies that the process that sets the hook MUST continue running while the hook is in place and unhook when it terminates.

Do you know the difference between static and dynamic linking?

My statement:

This MUST be the module handle of the DLL within which the Keyboard procedure is defined.

means that you MUST USE A DLL == Dynamic Linked Library.

This article has been dead for over six months. Start a new discussion instead.