Before any thread in an application can create windows, it must:
Then, it can create one or more windows by calling one of the window-creation functions, such as WinCreateWindow.
The window-creation functions require that the following information be supplied in some form:
Every window belongs to a window class that defines that window's appearance and behavior. The chief component of the window class is the window procedure. The window procedure is the function that receives and processes all messages sent to the window.
Every window has a style. The window style specifies aspects of a window's appearance and behavior that are not specified by the window's class. For example, the WC_FRAME class always creates a frame window, but the FS_BORDER, FS_DLGBORDER, and FS_SIZEBORDER styles determine the style of a frame window's border. A few window styles apply to all windows, but most apply only to windows of specific window classes. The window procedure for a given class interprets the style and allows an application to adapt a window of a given class for a special circumstance. For example, an application can give a window the style WS_SYNCPAINT to cause it to be painted immediately whenever any portion of the window becomes invalid. Normally, a window is painted only if there are no messages waiting in the message queue.
A window can have a text string associated with it. Typically, the window text is displayed in the window or in a title bar. The class of window determines whether the window displays the text and, if so, where the text appears within the window.
Every window except the desktop window and desktop-object window has a parent window. The parent provides the coordinate system used to position the window and also affects aspects of a window's appearance. For example, when the parent window is minimized, hidden, or destroyed, the parent's child windows are minimized, hidden, or destroyed also.
Every window has a screen position, size, and z-order position. The screen position is the location of the window's lower-left corner, relative to the lower-left corner of its parent window. A window's size is its width and height, measured in pels. A window's z-order position is the position of the window in the order of overlapping windows. This viewing order is oriented along an imaginary axis, the z axis, extending outward from the screen. The window at the top of the z-order overlaps all sibling windows (that is, windows having the same parent window). A window at the bottom of the z-order is overlapped by all sibling windows. An application sets a window's z-order position by placing it behind a given sibling window or at the top or bottom of the z-order of the windows.
A window can own, or be owned by, another window. The owner-owned relationship affects how messages are sent between windows, allowing an application to create combinations of windows that work together. A window issues messages about its state to its owner window; the owner window issues messages back about what action to perform next.
The window handle is a unique number across the system that is totally unambiguous-it identifies one particular window in the system and is assigned by the system. A window identifier is analogous to a "given" name in family relationships; the only requirement is that the name be unique among siblings.
A window can have class-specific data that further defines how the window appears and behaves when it is created. The system passes the class-specific data to the window procedure, which then applies the data to the new window.