Why isn't WH_MOUSE hook global anymore?

Posted by Valentin Galea on Stack Overflow See other posts from Stack Overflow or by Valentin Galea
Published on 2009-06-18T21:51:07Z Indexed on 2010/06/08 5:02 UTC
Read the original article Hit count: 316

Filed under:
|
|
|
|

I have this global mouse hook setup in a DLL that watches for mouse gestures.

Everything works perfectly but with a hook set for WH_MOUSE_LL which is a low-level hook and one that doesn't need to be in an external injectable DLL.

Once I switch - to the more suitable one would say - WH_MOUSE mouse hook, everything falls apart. Once I click outside my main application (the one that installs the hook), the hook gets corrupted - ::UnhookWindowsHookEx will fail.

I only found this guy saying at experts exchange:

"No way, at least under Windows XP + SVP2 WH_MOUSE won't go global, you must use WH_MOUSE_LL instead."

I setup the hooks correctly: in a DLL using a shared data section, posting and not sending messages from the hook proceduce.

Why has this changed? And why is not documented? Anyone encountered this? Thanks!

BTW: I've reverse engineered a bit the popular StrokeIt application and it uses a combination of WH_GETMESSAGE and WH_MOUSE hooks and still works on XP/Vista...

© Stack Overflow or respective owner

Related posts about c

    Related posts about winapi