The elements of a window class define the default behavior of windows belonging to the class. The application that registers a window class assigns elements to the class by setting appropriate members in a WNDCLASSEX structure and passing the structure to the RegisterClassEx function. The GetClassInfoEx and GetClassLong functions retrieve information about a given window class. The SetClassLong function changes elements of a local or global class that the application has already registered.
Although a complete window class consists of many elements, the system requires only that an application supply a class name, the window-procedure address, and an instance handle. Use the other elements to define default attributes for windows of the class, such as the shape of the cursor and the content of the menu for the window. You must initialize any unused members of the WNDCLASSEX structure to zero or NULL. The window class elements are as follows.
Element | Purpose |
---|---|
Class name | Distinguishes the class from other registered classes. |
Window-procedure address | Pointer to the function that processes all messages sent to windows in the class and defines the behavior of the window. |
Instance handle | Identifies the application or DLL that registered the class. |
Class cursor | Defines the mouse cursor that the system displays for a window of the class. |
Class icons | Defines the large icon and the small icon (starting with Windows 95 and Windows NT 4.0). |
Class background brush | Defines the color and pattern that fill the client area when the window is opened or painted. |
Class menu | Specifies the default menu for windows that do not explicitly define a menu. |
Class styles | Defines how to update the window after moving or resizing it, how to process double-clicks of the mouse, how to allocate space for the device context, and other aspects of the window. |
Extra class memory | Specifies the amount of extra memory, in bytes, that the system should reserve for the class. All windows in the class share the extra memory and can use it for any application-defined purpose. The system initializes this memory to zero. |
Extra window memory | Specifies the amount of extra memory, in bytes, that the system should reserve for each window belonging to the class. The extra memory can be used for any application-defined purpose. The system initializes this memory to zero. |