Window Styles

Window styles are attributes that are controlled by specific window style flags. There are also extended window styles that have their own set of flags. For this discussion, "window style" refers to the basic window styles, as well as the extended window styles. However, when you write code, you must distinguish between the two. The basic window styles have a prefix of WS_*; the extended styles have a prefix of WS_EX_*.

Most window styles are set when you create a window. There are a few, however, which are sometimes useful to change while a program is running. Use the SetWindowLong function to change a window style.

General window styles supported by Windows CE are described in the following table.

Style Meaning
WS_CHILD Specifies a child window. This should not be changed after the window is created.
WS_POPUP Specifies a pop-up window. This style should not be changed after the window is created.
WS_VISIBLE Specifies a window that is initially visible. This style can be turned on and off to change window visibility.
WS_DISABLED Specifies a window that is initially disabled. A disabled window cannot receive input from the user.
WS_CLIPCHILDREN Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used on the parent window. Windows CE windows always have the WS_CLIPCHILDREN style.
WS_CLIPSIBLINGS Excludes the area occupied by sibling windows that are above a window.
WS_GROUP Specifies the first control of a group of controls. This style is used primarily when creating dialog boxes. The group consists of this first control and all controls defined after it, up to the next control for which the WS_GROUP style is specified. Because the first control in each group often has the WS_TABSTOP style, a user can move from group to group.
WS_TABSTOP Specifies a control that can receive the keyboard focus when the user presses the TAB key. This style is used primarily when creating controls in a dialog box. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
WS_EX_NOACTIVATE Specifies that a window cannot be activated. If a child window has this style, tapping it does not cause its top-level parent to activate. Although a window that has this style will still receive stylus events, neither it nor its child windows can get the focus.
WS_EX_NODRAG Specifies a stationary window that cannot be dragged by its title bar.
WS_EX_NOANIMATION Prevents a window from showing animated exploding and imploding rectangles and from having a button on the taskbar.
WS_EX_TOPMOST Creates a window that will be placed and remain above all non-topmost windows. To add or remove this style, use the SetWindowPos function.

Note Windows-based desktop platforms do not support the WS_EX_NODRAG, WS_EX_NOACTIVATE, and WS_EX_NOANIMATION styles. These styles are only available in Windows CE.