Window Classes

This topic describes the types of window classes, how the system locates them, and the elements that define the default behavior of windows that belong to them.

A window class is a set of attributes that the system uses as a template to create a window. Every window is a member of a window class. All window classes are process specific.

In This Section

Name Description
About Window Classes Discusses window classes. Each window class has an associated window procedure shared by all windows of the same class. The window procedure processes messages for all windows of that class and therefore controls their behavior and appearance.
Using Window Classes Demonstrates how to register a local window and use it to create a main window.
Window Class Reference Contains the API reference.

 

Window Class Functions

Name Description
GetClassInfoEx Retrieves information about a window class, including a handle to the small icon associated with the window class. The GetClassInfo function does not retrieve a handle to the small icon.
GetClassLong Retrieves the specified 32-bit (long) value from the WNDCLASSEX structure associated with the specified window.
GetClassLongPtr Retrieves the specified value from the WNDCLASSEX structure associated with the specified window.
GetClassName Retrieves the name of the class to which the specified window belongs.
GetWindowLong Retrieves information about the specified window. The function also retrieves the 32-bit (long) value at the specified offset into the extra window memory.
GetWindowLongPtr Retrieves information about the specified window. The function also retrieves the value at a specified offset into the extra window memory.
RegisterClass Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.
RegisterClassEx Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.
SetClassLongPtr Replaces the specified value at the specified offset in the extra class memory or the WNDCLASSEX structure for the class to which the specified window belongs.
SetClassWord Replaces the 16-bit (WORD) value at the specified offset into the extra class memory for the window class to which the specified window belongs.
SetWindowLong Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.
SetWindowLongPtr Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.
UnregisterClass Unregisters a window class, freeing the memory required for the class.

 

The following functions are obsolete.

Name Description
GetClassInfo Retrieves information about a window class.
[!Note]
The GetClassInfo function has been superseded by the GetClassInfoEx function. You can still use GetClassInfo, however, if you do not need information about the class small icon.

GetClassWord Retrieves the 16-bit (WORD) value at the specified offset into the extra class memory for the window class to which the specified window belongs.
[!Note]
This function is deprecated for any use other than nIndex set to GCW_ATOM. The function is provided only for compatibility with 16-bit versions of Windows. Applications should use the GetClassLong function.


SetClassLong Replaces the specified 32-bit (long) value at the specified offset into the extra class memory or the WNDCLASSEX structure for the class to which the specified window belongs.
[!Note]
This function has been superseded by the SetClassLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Windows, use SetClassLongPtr.


 

Window Class Structures

Name Description
WNDCLASS Contains the window class attributes that are registered by the RegisterClass function.
This structure has been superseded by the WNDCLASSEX structure used with the RegisterClassEx function. You can still use WNDCLASS and RegisterClass if you do not need to set the small icon associated with the window class.
WNDCLASSEX Contains window class information. It is used with the RegisterClassEx and GetClassInfoEx  functions.
The WNDCLASSEX structure is similar to the WNDCLASS structure. There are two differences. WNDCLASSEX includes the cbSize member, which specifies the size of the structure, and the hIconSm member, which contains a handle to a small icon associated with the window class.