Window Attributes
An application must provide the following information when creating a window:
- Window class
- Window name
- Window style
- Parent or owner window
- Size
- Location
- Position
- Child-window identifier or menu handle
- Instance handle
- Creation data
These attributes are described in the following sections.
Window Class
Every window belongs to a window class. An application must register a window
class before creating any windows of that class. The
window class defines most aspects of a window's appearance and behavior. The chief
component of a window class is the
window procedure, a function that receives and processes all input and requests sent to the
window. Windows provides the input and requests in the form of
messages. For more information about window classes, window procedures, or messages,
see
Window Classes,
Window Procedures, or
Messages and Message Queues.
Window Name
A window can have a name. A
window name (also called
window text) is a text string that identifies a window for the user. A main window,
dialog box, or message box typically displays its window name in its title bar, if
present. For a control, the appearance of the window name depends on the
control's class. A button, edit control, or static control displays its window name
within the rectangle occupied by the control. A list box, combo box, or static
control does not display its window name.
An application uses the
SetWindowText function to change the window name after creating the window. It uses the
GetWindowTextLength and
GetWindowText functions to retrieve the current window-name text from a window.
Window Style
Every window has one or more window styles. A
window style is a named constant that defines an aspect of the window's appearance and
behavior that is not specified by the window's class. For example, the SCROLLBAR
class creates a scroll bar control, but the SBS_HORZ and SBS_VERT styles
determine whether a horizontal or vertical scroll bar control is created. A few window
styles apply to all windows, but most apply to windows of specific window
classes. Windows and, to some extent, the window procedure for the class, interpret
the styles.
Parent or Owner Window
A window can have a parent window. A window that has a parent is called a
child window. The
parent window provides the coordinate system used for positioning a child window. Having a
parent window affects aspects of a window's appearance; for example, a child
window is clipped so that no part of the child window can appear outside the
borders of its parent window. A window that has no parent, or whose parent is the
desktop window, is called a
top-level window. An application uses the
EnumWindows function to obtain the handle of each of its top-level windows.
EnumWindows passes the handle of each top-level window, in turn, to an
application-defined callback function,
EnumWindowsProc.
A window can own, or be owned by, another window. An owned window always
appears in front of its owner window, is hidden when its owner window is minimized,
and is destroyed when its owner window is destroyed.
Location, Size, and Position in the Z Order
Every window has a location, size, and position in the Z order. The location
is the coordinates of the window's upper left corner, relative to the upper left
corner of the screen or, in the case of a child window, the upper left corner
of the parent's client area. A window's size is its width and height measured
in pixels. A window's position in the
Z order is the position of the window in a stack of overlapping windows. For more
information, see
Z Order.
Child-Window Identifier or Menu Handle
A child window can have a
child-window identifier, a unique, application-defined value associated with the child window.
Child-window identifiers are especially useful in applications that create multiple
child windows. When creating a child window, an application specifies the
identifier of the child window. After creating the window, the application can change
the window's identifier by using the
SetWindowLong function, or it can retrieve the identifier by using the
GetWindowLong function.
Every window, except a child window, can have a menu. An application can
include a menu by providing a menu handle either when registering the window's class
or when creating the window.
Instance Handle
Every Win32-based application has an instance handle associated with it.
Windows provides the instance handle to an application when the application starts.
Because it can run multiple copies of the same application, Windows uses
instance handles internally to distinguish one instance of an application from
another. The application must specify the instance handle in many different windows,
including those that create windows.
Creation Data
Every window can have application-defined creation data associated with it.
When the window is first created, Windows passes a pointer to the data on to the
window procedure of the window being created. The window procedure uses the
data to initialize application-defined variables.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database