Window Fundamentals

The appearance and behavior of a window is largely determined by its inherent attributes and its relationship to other windows. You assign attributes to a window by setting window styles and extended styles, and by calling functions that alter window attributes.

Windows are always rectangular. They are placed above and below each other along an imaginary line that runs perpendicular to the screen. This stack of windows is called the Z order. Each window has a unique position in the Z order. Windows that appear first in the Z order are considered to be in front of, or on top of, windows that appear later in the Z order. A window's position in the Z order affects its screen appearance. Windows may partially or totally obscure each other depending on their location, size, and position in the Z order.

A window is divided into a nonclient area, which is occupied by borders, scroll bars, and various other controls, and a client area, which is everything else. You are free to draw in the client area, but not in the nonclient area. In Windows CE, the nonclient area of a window is controlled exclusively by the window manager. Windows CE does not send applications any messages dealing with the nonclient area.

A window may be visible or hidden, depending on whether or not its WS_VISIBLE style is turned on or off. A window that has the WS_VISIBLE style turned off will not be visible on the screen. A window that has the WS_VISIBLE style turned on may or may not be visible on the screen, depending on whether it is obscured by other windows. Covering or uncovering a window with another window does not change the WS_VISIBLE style.

Every window has a unique identifier called a window handle. When you create a window, you receive a window handle, which you can then use to call functions that use the window. Window identifiers are especially useful in applications that create multiple child windows. Applications can change the window's identifier by using the SetWindowLong function and retrieve the identifier by using the GetWindowLong function.