Search code examples
windowsuser-interfacewinapi

What's the difference between RealGetWindowClass and GetClassName? (or what is a "Window type" versus a "Window class name"?)


There is a difference in the description on MSDN, however, I do not understand what the text means what the difference is.

The GetClassName function retrieves the name of the class to which the specified window belongs. The RealGetWindowClass function retrieves a string that specifies the window type.

As an example using windows calc.exe
From GetClassName you get "SciCalc"
From RealGetWindowClass you get "#32770"

I guess what I'm really asking then is what is a "Window type" versus a "Window class name"?


Solution

  • See the following article:

    What makes RealGetWindowClass so much more real than GetClassName?

    Summary:

    Recall from last time that the Real... functions were added to support Windows accessibility. The goal with Real­Get­Window­Class 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 Real­Get­Window­Class 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 Get­Class­Name would return Awesome­Button, but a call to Real­Get­Window­Class would return button.