SetWindowsHookEx

c++ / delphi package - dll injection and api hooking
Post Reply
Azmodeus
Posts: 60
Joined: Mon May 03, 2004 7:41 am

SetWindowsHookEx

Post by Azmodeus »

It seems that since the dll is loaded into the memory space of all DLL's anyway (if using system-wide injection) that it would be very easy without any additional system performance to be able to create hooks similar to the SetWindowsHookEx function.

The reason I ask, is that whe I use SetWindowsHookEx(WH_GETMESSAGE,x,x,0) it drastically slows down background processing of desktop windows.

I know it is not the hook function, because I am just forwarding the call using CallNextHookEx.

So, does any of your (madshi) apps support anything to grab the keyboard/mouse messages that I have missed?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Hooking messages can cost quite much performance, because messages are used so much in Windows. I'm not sure whether madCodeHook installed message hooks would be faster than SetWindowsHookEx. I doubt it, but I'm not sure.

I generally recommend using SetWindowsHookEx if it offers the functionality you need. It is always recommend to use documented stuff if possible.

That doesn't mean that madCodeHook couldn't do the very same thing. Probably it could.
Post Reply