Message Hook Functions

Windows provides a very powerful set of functions that allow you to set message hooks. Hooks let a module (an application or DLL) intercept messages going to other applications. The messages can be acted on, modified, or even stopped. One good way to use a hook function would be to remap the keyboard. Every keyboard message could be intercepted and then modified to reflect a different keyboard layout. More sophisticated uses are to modify the behavior of specific applications.

The SetWindowsHookEx function installs the hook procedure. If messages are only to be filtered for an application, the filter functions can reside in the application itself. However, if messages are going to be filtered for all applications, the filter ...

Get Microsoft Windows 2000 API SuperBible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.