A Thread-Specific Example

This example uses the WH_SHELL example that was presented in Chapter 17. Figure 21-2 shows the application’s user interface. As you can see, a checkbox labeled Discard Msg has been added to the example. When checked, it causes the WH_DEBUG hook to return a nonzero value, effectively preventing the target hook from being called. Otherwise, all messages will safely pass through this hook to the target hook.

A screenshot of the WH_SHELL/WH_DEBUG example

Figure 21-2. A screenshot of the WH_SHELL/WH_DEBUG example

Table 21-1 presents the nondefault properties of the form and its controls.

Table 21-1. Nondefault Properties of the Form and Its Controls

Object

Property Name

Property Value

Form1

Name

Form2

Form1

Caption

“WH_SHELL Example”

Form1

Top

330

Form1

Left

105

Form1

Height

4710

Form1

Width

7095

Form2

Name

Form1

Form2

Caption

“NEW FORM”

Command Button1

Name

cmdHook

Command Button1

Caption

“hook”

Command Button1

Top

120

Command Button1

Left

120

Command Button1

Height

300

Command Button1

Width

915

Command Button2

Name

cmdUnhook

Command Button2

Caption

“unhook”

Command Button2

Top

780

Command Button2

Left

120

Command Button2

Height

300

Command Button2

Width

915

Command Button3

Name

cmdCreateWnd

Command Button3

Caption

“CreateWnd”

Command Button3

Top

3180

Command Button3

Left

120

Command Button3

Height

315

Command Button3

Width

Get Subclassing and Hooking with Visual Basic 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.