Caveats
Once again, performance might be an issue with the use of the
WH_MOUSE or WH_MOUSE_LL hook,
especially with system-wide and low-level mouse hooks. You should use
these hooks judiciously. For more information on the problems with
low-level hooks, refer to Section 12.6 of Chapter 12.
When using the low-level mouse hook (WH_MOUSE_LL),
note that the debug hook cannot receive the input to this hook before
the hook is called. The debug hook works normally with the mouse hook
(WH_MOUSE). The debug hook is described in Chapter 21.
A registry key is associated with low-level hooks, such as
WH_MOUSE_LL and WH_KEYBOARD_LL
(see Chapter 12). The numeric registry value
LowLevelHooksTimeout is located in the following
registry key:
HKEY_CURRENT_USER\Control Panel\Desktop
This value controls the timeout period in milliseconds for all low-level hooks. If the filter function for a low-level hook does not return within this time span, the system will call the next low-level hook in the chain.
Although all 32-bit and 64-bit operating systems support the
WH_MOUSE hook, all do not support the
WH_MOUSE_LL hook. The
WH_MOUSE_LL hook is found only in Windows NT
(Service Pack 3 or higher) and Windows 2000; it is not found in
Windows 9x.
As one final caution, there is a bug when using the mouse hooks from within a VB user control. Article Q238672 in the Microsoft Developer Network (MSDN) details the bug and how to work around it (Visual Studio 6, Service Pack 4 solves this problem).
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access