Chapter 2. Windows System-Specific Information

Before delving into the guts of subclassing and using hooks, we must first learn how the Windows messaging system works. This chapter is not going to teach you all the details of processes, threads, or some of the other Windows objects encountered while programming the operating system. Instead, I will concentrate on the particulars of the Windows operating system only insofar as they apply to the subject of this book.

Understanding how the Windows messaging subsystem works is a necessary first step toward learning how to correctly design and implement subclassing and hooks through Visual Basic (VB). In fact, this holds true for using subclassing or hooks in any language, but it is more important in VB because VB shields the developer from going too deeply into the Windows internals. This is a double-edged sword. On one hand, VB makes it very simple to construct applications that might take much more time and effort in a different language such as C++. On the other hand, not being able to easily get intimate with the lower levels of the Windows operating system makes the task of debugging and implementing advanced functionality into our applications more difficult. Knowledge of what is happening in the system, where it is happening, and why it is happening is essential to constructing and debugging your applications.

Tinkering with the Windows messaging system is neither straightforward nor easy. One wrong line of code, one misplaced ...

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.