Peering into the Superclassing Application with Spy++
When using Spy++ to analyze this superclassing
example application, we see several
interesting things. Examining the window and window class information
for each window of the application, we notice that all the
information from the original class is copied over to the superclass.
For example, the ThunderRT6FormDC
base class
information contains this data:
Class WndProc 6601FFCB hInstance 66000000 Style CS_DBLCLKS or CS_OWNDC Class Extra Bytes 0 Wnd Extra Bytes 2 Menu (none) Icon Handle (none) Cursor Handle IDC_ARROW Bkgnd Brush COLOR_WINDOW
Using GetClassInfoEx and
RegisterClassEx, we made a copy of the
ThunderRT6FormDC
base class and registered it as
the NewMainWndClass
superclass. The
NewMainWndClass
superclass information contains
this data:
Class WndProc 004032CE hInstance 00400000 Style CS_DBLCLKS or CS_OWNDC Class Extra Bytes 0 Wnd Extra Bytes 2 Menu (none) Icon Handle (none) Cursor Handle IDC_UPARROW Bkgnd Brush COLOR_WINDOW
The class name (lpszClassName
), the class
window procedure (lpfnWndProc
), the
instance handle (hInstance
), and the
Cursor Handle (hCursor
) were the only
class structure members modified. The above information reflects
these changes. All other class information is copied into the
NewMainWndClass
superclass verbatim.
We superclass the BUTTON
base class in a similar
way, except hCursor
is not modified. The
global BUTTON
base class contains this data:
Class WndProc 77E8BB63 hInstance NULL Style CS_PARENTDC ...
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.