Jump to content

Window class

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jamesday (talk | contribs) at 14:33, 17 November 2003 (revert to Mintguy version, per VfD result in talk.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer programming a window class is a structure fundamental to the Microsoft Windows (Win16 and Win32) operating systems and its Application Programming Interface (API). The structure provides a template, from which a window may be created, by specifying a window's icon, menu, background color and a few other features. It also holds a pointer to a procedure that controls how the window behaves in response to user interaction. Although a windows class bears some similarity to the concept of a class in object-oriented programming, the API of the Windows operating system does not follow the object-oriented paradigm.

It is defined in the C programming language as struct WNDCLASS or WNDCLASSEX

typedef struct {
    UINT style;
    WNDPROC lpfnWndProc;
    int cbClsExtra;
    int cbWndExtra;
    HINSTANCE hInstance;
    HICON hIcon;
    HCURSOR hCursor;
    HBRUSH hbrBackground;
    LPCTSTR lpszMenuName;
    LPCTSTR lpszClassName;
} WNDCLASS, *PWNDCLASS;

or

typedef struct {
    UINT cbSize;
    UINT style;
    WNDPROC lpfnWndProc;
    int cbClsExtra;
    int cbWndExtra;
    HINSTANCE hInstance;
    HICON hIcon;
    HCURSOR hCursor;
    HBRUSH hbrBackground;
    LPCTSTR lpszMenuName;
    LPCTSTR lpszClassName;
    HICON hIconSm;
} WNDCLASSEX, *PWNDCLASSEX;