2.4. Hooks for Handling Messages

In stead of relying on the built-in Windows accessibility functions, the Win32 hook functions provide a good basis for implementing a screen reader. This fact is also mentioned on a Web page about the workings of a screen reader: currently, most Windows screen readers use system hooks to gain access to keyboard input and menu and dialog box messages (Iowa Department for the Blind, 2004, How Does a Screen Reader Work?).

Microsoft defines a hook in it's hook article as a function, that can intercept various messages before they reach the application to which the message was originally sent (Microsoft, 1993, Win32 Hooks). Microsoft's term for a function processing the intercepted messages is a filter function but the term hook is usually synonymous with filter function. There are many different types of hooks and hooks handling the same messages may form chains, in which a message passes through several hooks.

THere are two fundamentally different types of hooks thread-specific and systemwide. Thread-specific hooks can only access the messages sent in the same thread that installed the hook where as systemwide hooks are able to intercept virtually every message in the whole operating system. Microsoft's hook article also says that a systemwide hook must reside in its own dynamic link library (dll). We talk more about dlls in chapter 3.1.

Back to the Contents