This book is grouped into four distinct sections. The first is the introductory section, which contains information about the Windows operating system and the basics of subclassing and hooking. This section lays the foundation that will enable you to completely grasp the rest of the material in this book. This section contains the following chapters:
- Chapter 1
This chapter defines subclassing and hooking and gives several examples of how each can be used effectively. In addition, the tools used in this book are explained. The tools include the following:
Spy++, which enables us to view information about processes, windows, and messages. This tool comes as part of the Visual Studio Version 6 development environment.
The Dbgwproc.dll DLL, which enables us to more easily debug subclassing code within projects written in Versions 5 or 6 of VB. This tool can be downloaded from http://msdn.microsoft.com/vbasic/downloads/controls.asp.
Microsoft System Information, which enables us to see the installed hooks in a Windows 98 system. This tool can be accessed from the Help → About Microsoft Visual Basic... menu item on the Visual Basic main menu bar. When the About dialog box appears, click the System Info... button to view the Microsoft System Information tool.
SmartCheck, developed by Compuware Numega Labs, which enables us to watch under the hood as a VB project runs. A 14-day trial version of this software is available from Compuware Numega Labs at http://www.numega.com/evaluations/default.asp.
- Chapter 2
This chapter contains information on Windows’ processes, threads, windows, and messaging system, as well as how they relate to subclassing and hooking.
- Chapter 3
This chapter starts out with a discussion of how subclassing operates and the different types of subclassing at your disposal, and is followed by a discussion of how hooking operates. Finally, the pros and cons of using subclassing and hooks are laid out for you.
The second section covers the technique of subclassing and its variations. The process of subclassing VB forms is discussed, along with subclassing controls, common dialog boxes, and ActiveX controls that you create. Adding to this, global subclassing and superclassing are discussed at length, along with debugging your subclassing code. This section contains the following chapters:
- Chapter 4
A discussion of the
AddressOf
operator is presented first, followed by an in-depth discussion of the various types of subclassing, along with examples of each type. Tips for using subclassing are presented throughout this chapter.- Chapter 5
A crash course on using the Windows Common Dialog APIs is presented first. Next, the technique of subclassing the Open and Save As common dialogs is discussed and examples are provided. Finally, the chapter finishes with a discussion of subclassing each of the other common dialogs.
- Chapter 6
This chapter discusses how to subclass a third-party ActiveX control and an ActiveX control that we create in VB. Next follows a discussion of subclassing a UserControl from within an ActiveX control that is created in VB. This chapter finishes by creating an ActiveX control that is used to subclass a VB form.
- Chapter 7
The technique of superclassing a window is discussed and examples are provided, and the differences and similarities between superclassing and other types of subclassing are noted.
- Chapter 8
This chapter presents various techniques used to debug your subclassing application. Along with this discussion, several of the previously mentioned tools are discussed in more detail.
The third section covers the technique of hooking. Fifteen different types of hooks are discussed, each in its own chapter (except for the mouse and low-level keyboard hooks, which are grouped with the regular mouse and keyboard hooks, respectively). This section contains the following chapters:
- Chapter 9
The
WH_CALLWNDPROC
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 10
The
WH_CALLWNDPROCRET
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 11
The
WH_GETMESSAGE
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 12
The
WH_KEYBOARD
andWH_KEYBOARD_LL
hooks are presented in this chapter, along with details of their operation, examples, and things to watch out for when using them.- Chapter 13
The
WH_MOUSE
andWH_MOUSE_LL
hooks are presented in this chapter, along with details of their operation, examples, and things to watch out for when using them.- Chapter 14
The
WH_FOREGROUNDIDLE
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 15
The
WH_MSGFILTER
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 16
The
WH_SYSMSGFILTER
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 17
The
WH_SHELL
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 18
The
WH_CBT
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 19
The
WH_JOURNALRECORD
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it.- Chapter 20
The
WH_JOURNALPLAYBACK
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it. A discussion of how this hook is used in tandem with the WH_JOURNALRECORD hook also is provided.- Chapter 21
The
WH_DEBUG
hook is presented in this chapter, along with details of its operation, examples, and things to watch out for when using it. Also discussed are ways to enhance the debugging of hooks in your applications.
The fourth and final section covers the techniques of subclassing and hooking as they apply to the new VB.NET language. This section contains the following chapters:
- Chapter 22
The various techniques of subclassing using the new VB.NET language are presented in this chapter, along with examples.
- Chapter 23
This chapter discusses how to use hooks with the new VB.NET language. Examples using various hooks also are provided.
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.