Behind the Scenes with Spy++

To understand more of what is happening when we subclass a WinForm, we will use the Spy++ utility to see what is happening to our application before, during, and after we subclass an application.

To start, we will run the example application that we created in Section 22.2.1. After starting Spy++ and finding the application, we immediately notice several things, as Figure 22-8 illustrates.

Using Spy++ to examine our VB.NET subclassing application created using Technique #1

Figure 22-8. Using Spy++ to examine our VB.NET subclassing application created using Technique #1

The first thing of interest is that six threads are automatically created when a VB.NET application starts. Our application code runs in thread 0, which has a handle of &H5F4 in Figure 22-8. Using the Threading classes in the .NET framework, you can create even more threads. The examples presented here do not create multiple threads. However, if you create more threads using the Threading classes, you should be aware that the subclassing techniques described in this chapter work only within the thread that uses these techniques.

The other item of interest is the class names of the WinForm and its controls. Gone are the familiar Thunder* classes; even the standard windows classes, such as BUTTON and EDIT, are gone. Languages that run under the .NET framework, such as VB.NET and C#, use classes such as WinForms10.Window.8.app29 for a WinForm, WinForms10.BUTTON.app29 for button ...

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.