There’s
GetClassName
and then there’s
RealGetWindowClass
.
What makes
RealGetWindowClass
more real?
Recall from last time that
the Real...
functions were added to support
Windows accessibility.
The goal with RealGetWindowClass
is to help
accessibility tools identify what kind of window it is working with,
even if the application did a little disguising in the form of
superclassing.
If you ask
RealGetWindowClass
for the class name of a window,
it digs through all the superclassing and returns the name of the
base class (if the base class is one of the standard window manager classes).
For example, if your application superclassed the button
class,
a call to GetClassName
would return
AwesomeButton
,
but a call to
RealGetWindowClass
would return button
.
Returning the underlying window class allows accessibility tools
to know that the user is interacting with some type of button control
(albeit a customized one),
so that it can adjust the interaction to something appropriate
for buttons.
Without RealGetWindowClass
,
the accessibility tool would just see AwesomeButton
,
and it would probably shrug and say,
“I have no idea what a AwesomeButton
is.”
(I guess you could have the accessibility tool do a
strstr
for button
,
but then it would be faked out by classes like
ButtonBar
or applications which superclass
a button but call it something completely different like
AwesomeRadio
.)
If you read the winuser.h
header file,
you can see a comment next to the
RealGetWindowClass
function:
/* * This gets the name of the window TYPE, not class. This allows us to * recognize ThunderButton32 et al. */
What is ThunderButton32
?
Thunder was
the code name for Visual Basic 1.0.
Visual Basic superclassed all the standard Windows controls
and called its superclassed version ThunderWhatever
.
0 comments