HWND CreateWindow(lpszClassName, lpszWindowName, dwStyle, x, y, nWidth, nHeight, hwndParent, hmenu, hinst, lpvParam) | |||||
LPCSTR lpszClassName; | /* address of registered class name | */ | |||
LPCSTR lpszWindowName; | /* address of window text | */ | |||
DWORD dwStyle; | /* window style, */ | ||||
int x; | /* horizontal position of window | */ | |||
int y; | /* vertical position of window | */ | |||
int nWidth; | /* window width, */ | ||||
int nHeight; | /* window height, */ | ||||
HWND hwndParent; | /* handle of parent window | */ | |||
HMENU hmenu; | /* handle of menu or child-window identifier | */ | |||
HINSTANCE hinst; | /* handle of application instance | */ | |||
void FAR* lpvParam; | /* address of window-creation data | */ |
The CreateWindow function creates an overlapped, pop-up, or child window. The CreateWindow function specifies the window class, window title, window style, and (optionally) the initial position and size of the window. The CreateWindow function also specifies the window's parent (if any) and menu.
lpszClassName
Points to a null-terminated string specifying the window class. The class name can be any name registered with the RegisterClass function or any of the predefined control-class names. (See the following Comments section for a complete list.)
lpszWindowName
Points to a null-terminated string that represents the window name.
dwStyle
Specifies the style of window being created. This parameter can be a combination of the window styles and control styles given in the following Comments section.
x
Specifies the initial x-position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window in the client area of its parent window.
If this value is CW_USEDEFAULT, Windows selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows. If CW_USEDEFAULT is specified for a non-overlapped window, the x and y parameters are set to 0.
y
Specifies the initial y-position of the window. For an overlapped window, the y parameter is the initial y-coordinate of the window's upper-left corner. For a pop-up window, y is the y-coordinate, in screen coordinates, of the upper-left corner of the pop-up window. For list-box controls, y is the y-coordinate of the upper-left corner of the control's client area. For a child window, y is the y-coordinate of the upper-left corner of the child window. All of these coordinates are for the window, not the window's client area.
If an overlapped window is created with the WS_VISIBLE style and the x parameter set to CW_USEDEFAULT, Windows ignores the y parameter.
nWidth
Specifies the width, in device units, of the window. For overlapped windows, the nWidth parameter is either the window's width (in screen coordinates) or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, Windows selects a default width and height for the window (the default width extends from the initial x-position to the right edge of the screen, and the default height extends from the initial y-position to the top of the icon area). CW_USEDEFAULT is valid only for overlapped windows. If CW_USEDEFAULT is specified in nWidth for a non-overlapped window, nWidth and nHeight are set to 0.
nHeight
Specifies the height, in device units, of the window. For overlapped windows, the nHeight parameter is the window's height in screen coordinates. If the nWidth parameter is CW_USEDEFAULT, Windows ignores nHeight.
hwndParent
Identifies the parent or owner window of the window being created. A valid window handle must be supplied when creating a child window or an owned window. An owned window is an overlapped window that is destroyed when its owner window is destroyed, hidden when its owner is minimized, and that is always displayed on top of its owner window. For pop-up windows, a handle can be supplied but is not required. If the window does not have a parent window or is not owned by another window, the hwndParent parameter must be set to HWND_DESKTOP.
hmenu
Identifies a menu or a child window. This parameter's meaning depends on the window style. For overlapped or pop-up windows, the hmenu parameter identifies the menu to be used with the window. It can be NULL, if the class menu is to be used. For child windows, hmenu identifies the child window and is an integer value that is used by a dialog box control to notify its parent of events (such as the EN_HSCROLL message). The child window identifier is determined by the application and should be unique for all child windows with the same parent window.
hinst
Identifies the instance of the module to be associated with the window.
lpvParam
Points to a value that is passed to the window through the CREATESTRUCT structure referenced by the lParam parameter of the WM_CREATE message. If an application is calling CreateWindow to create a multiple document interface (MDI) client window, lpvParam must point to a CLIENTCREATESTRUCT structure. The CREATESTRUCT structure has the following form:
typedef struct tagCREATESTRUCT { /* cs */
void FAR* lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
int cy;
int cx;
int y;
int x;
LONG style;
LPCSTR lpszName;
LPCSTR lpszClass;
DWORD dwExStyle;
} CREATESTRUCT;
The CLIENTCREATESTRUCT structure has the following form:
typedef struct tagCLIENTCREATESTRUCT { /* ccs */
HANDLE hWindowMenu;
UINT idFirstChild;
} CLIENTCREATESTRUCT;
For a full description of these two structures, see the Microsoft Windows Programmer's Reference, Volume 3.
The return value is the handle of the new window if the function is successful. Otherwise, it is NULL.
For overlapped, pop-up, and child windows, the CreateWindow function sends WM_CREATE, WM_GETMINMAXINFO, and WM_NCCREATE messages to the window. If the WS_VISIBLE style is specified, CreateWindow sends the window all the messages required to activate and show the window.
If the window style specifies a title bar, the window title pointed to by the lpszWindowName parameter is displayed in the title bar. When using CreateWindow to create controls such as buttons, check boxes, and edit controls, use the lpszWindowName parameter to specify the text of the control.
Before returning, the CreateWindow function sends a WM_CREATE message to the window procedure.
Following are the predefined control classes an application can specify in the lpszClassName parameter:
Class | Meaning |
BUTTON | Designates a small rectangular child window that represents a button the user can turn on or off by clicking. Button controls can be used alone or in groups, and can either be labeled or appear without text. Button controls typically change appearance when the user clicks them. |
COMBOBOX | Designates a control consisting of a list box and a selection field similar to an edit control. The list box may be displayed at all times or may be dropped down when the user selects a pop-up list box next to the selection field. |
Depending on the style of the combo box, the user can or cannot edit the contents of the selection field. If the list box is visible, typing characters into the selection box will cause the first list box entry that matches the characters typed to be highlighted. Conversely, selecting an item in the list box displays the selected text in the selection field. | |
EDIT | Designates a rectangular child window in which the user can type text from the keyboard. The user selects the control, and gives it the input focus by clicking it or moving to it by pressing the TAB key. The user can type text when the control displays a flashing caret. The mouse can be used to move the cursor and select characters to be replaced, or to position the cursor for inserting characters. The BACKSPACE key can be used to delete characters. |
Edit controls use the variable-pitch System font and display characters from the Windows character set. Applications compiled to run with earlier versions of Windows display text with a fixed-pitch System font unless they have been marked by the Windows 3.0 MARK utility (with the MEMORY FONT option specified). An application can also send the WM_SETFONT message to the edit control to change the default font. | |
Edit controls expand tab characters into as many space characters as are required to move the cursor to the next tab stop. Tab stops are assumed to be at every eighth character position. | |
LISTBOX | Designates a list of character strings. This control is used whenever an application must present a list of names, such as filenames, from which the user can choose. The user can select a string by pointing to it and clicking. When a string is selected, it is highlighted and a notification message is passed to the parent window. A vertical or horizontal scroll bar can be used with a list box control to scroll lists that are too long for the control window. The list box automatically hides or shows the scroll bar as needed. |
MDICLIENT | Designates an MDI client window. The MDI client window receives messages that control the MDI application's child windows. The recommended style bits are WS_CLIPCHILDREN and WS_CHILD. To create a scrollable MDI client window that allows the user to scroll MDI child windows into view, an application can also use the WS_HSCROLL and WS_VSCROLL styles. |
SCROLLBAR | Designates a rectangle that contains a scroll box (also called a “thumb”) and has direction arrows at both ends. The scroll bar sends a notification message to its parent window whenever the user clicks the control. The parent window is responsible for updating the position, if necessary. Scroll bar controls have the same appearance and function as scroll bars used in ordinary windows. Unlike scroll bars, however, scroll bar controls can be positioned anywhere in a window and used whenever needed to provide scrolling input for a window. |
The scroll bar class also includes size box controls (Maximize and Minimize buttons). These controls are small rectangles that the user can click to change the size of the window. | |
STATIC | Designates a simple text field, box, or rectangle that can be used to label, box, or separate other controls. Static controls take no input and provide no output. |
Following are the window styles an application can specify in the dwStyle parameter.
Style | Meaning |
MDIS_ALLCHILDSTYLES | Creates an MDI child window that can have any combination of window styles. When this style is not specified, an MDI child window has the WS_MINIMIZE, WS_MAXIMIZE, WS_HSCROLL, and WS_VSCROLL styles as default settings. |
WS_BORDER | Creates a window that has a border. |
WS_CAPTION | Creates a window that has a title bar (implies the WS_BORDER style). This style cannot be used with the WS_DLGFRAME style. |
WS_CHILD | Creates a child window. Cannot be used with the WS_POPUP style. |
WS_CHILDWINDOW | Same as the WS_CHILD style. |
WS_CLIPCHILDREN | Excludes the area occupied by child windows when drawing within the parent window. Used when creating the parent window. |
WS_CLIPSIBLINGS | Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only. |
WS_DISABLED | Creates a window that is initially disabled. |
WS_DLGFRAME | Creates a window with a double border but no title. |
WS_GROUP | Specifies the first control of a group of controls in which the user can move from one control to the next by using the arrow keys. All controls defined with the WS_GROUP style after the first control belong to the same group. The next control with the WS_GROUP style ends the style group and starts the next group (that is, one group ends where the next begins). Only dialog boxes use this style. |
WS_HSCROLL | Creates a window that has a horizontal scroll bar. |
WS_MAXIMIZE | Creates a window of maximum size. |
WS_MAXIMIZEBOX | Creates a window that has a Maximize button. |
WS_MINIMIZE | Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only. |
WS_MINIMIZEBOX | Creates a window that has a Minimize button. |
WS_OVERLAPPED | Creates an overlapped window. An overlapped window has a title and a border. |
WS_OVERLAPPEDWINDOW | Creates an overlapped window having the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. |
WS_POPUP | Creates a pop-up window. Cannot be used with the WS_CHILD style. |
WS_POPUPWINDOW | Creates a pop-up window that has the WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the System menu visible. |
WS_SYSMENU | Creates a window that has a System-menu box in its title bar. Used only for windows with title bars. |
WS_TABSTOP | Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style. Only dialog boxes use this style. |
WS_THICKFRAME | Creates a window with a thick frame that can be used to size the window. |
WS_VISIBLE | Creates a window that is initially visible. This applies to overlapped, child, and pop-up windows. For overlapped windows, the y parameter is used as a ShowWindow function parameter. |
WS_VSCROLL | Creates a window that has a vertical scroll bar. |
Following are the button styles (in the BUTTON class) that an application can specify in the dwStyle parameter:
Value | Meaning |
BS_3STATE | Creates a button that is the same as a check box, except that the box can be grayed (dimmed) as well as checked. The grayed state is used to show that the state of a check box is not determined. |
BS_AUTO3STATE | Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and normal. |
BS_AUTOCHECKBOX | Creates a button that is the same as a check box, except that an X appears in the check box when the user selects the box; the X disappears (is cleared) the next time the user selects the box. |
BS_AUTORADIOBUTTON | Creates a button that is the same as a radio button, except that when the user selects it, the button automatically highlights itself and clears (removes the selection from) any other buttons in the same group. |
BS_CHECKBOX | Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). |
BS_DEFPUSHBUTTON | Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style is useful for enabling the user to quickly select the most likely option (the default option). |
BS_GROUPBOX | Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper-left corner. |
BS_LEFTTEXT | Places text on the left side of the radio button or check box when combined with a radio button or check box style. |
BS_OWNERDRAW | Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created, and it receives a WM_DRAWITEM message when a visual aspect of the button has changed. The BS_OWNERDRAW style cannot be combined with any other button styles. |
BS_PUSHBUTTON | Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button. |
BS_RADIOBUTTON | Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices. |
Following are the combo box styles (in the COMBOBOX class) that an application can specify in the dwStyle parameter:
Style | Description |
CBS_AUTOHSCROLL | Automatically scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed. |
CBS_DISABLENOSCROLL | Shows a disabled vertical scroll bar in the list box when the box does not contain enough items to scroll. Without this style, the scroll bar is hidden when the list box does not contain enough items. |
CBS_DROPDOWN | Similar to CBS_SIMPLE, except that the list box is not displayed unless the user selects an icon next to the edit control. |
CBS_DROPDOWNLIST | Similar to CBS_DROPDOWN, except that the edit control is replaced by a static text item that displays the current selection in the list box. |
CBS_HASSTRINGS | Specifies that an owner-drawn combo box contains items consisting of strings. The combo box maintains the memory and pointers for the strings so the application can use the CB_GETLBTEXT message to retrieve the text for a particular item. |
CBS_NOINTEGRALHEIGHT | Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box. Normally, Windows sizes a combo box so that the combo box does not display partial items. |
CBS_OEMCONVERT | Converts text entered in the combo-box edit control from the Windows character set to the OEM character set and then back to the Windows set. This ensures proper character conversion when the application calls the AnsiToOem function to convert a Windows string in the combo box to OEM characters. This style is most useful for combo boxes that contain filenames and applies only to combo boxes created with the CBS_SIMPLE or CBS_DROPDOWN styles. |
CBS_OWNERDRAWFIXED | Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are all the same height. The owner window receives a WM_MEASUREITEM message when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box changes. |
CBS_OWNERDRAWVARIABLE | Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the combo box when the combo box is created and a WM_DRAWITEM message when a visual aspect of the combo box changes. |
CBS_SIMPLE | Displays the list box at all times. The current selection in the list box is displayed in the edit control. |
CBS_SORT | Automatically sorts strings entered into the list box. |
Following are the edit control styles (in the EDIT class) that an application can specify in the dwStyle parameter:
Style | Meaning |
ES_AUTOHSCROLL | Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero. |
ES_AUTOVSCROLL | Automatically scrolls text up one page when the user presses ENTER on the last line. |
ES_CENTER | Centers text in a multiline edit control. |
ES_LEFT | Left aligns text. |
ES_LOWERCASE | Converts all characters to lowercase as they are typed into the edit control. |
ES_MULTILINE | Designates a multiline edit control. (The default is single-line edit control.) |
When a multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, an application should use the ES_WANTRETURN style. | |
When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If ES_AUTOVSCROLL is not specified, the edit control shows as many lines as possible and beeps if the user presses ENTER when no more lines can be displayed. | |
If the ES_AUTOHSCROLL style is specified, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press ENTER. If ES_AUTOHSCROLL is not specified, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses ENTER. The position of the wordwrap is determined by the window size. If the window size changes, the wordwrap position changes and the text is redisplayed. | |
Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Edit controls without scroll bars scroll as described in the previous two paragraphs and process any scroll messages sent by the parent window. | |
ES_NOHIDESEL | Negates the default behavior for an edit control. The default behavior is to hide the selection when the control loses the input focus and invert the selection when the control receives the input focus. |
ES_OEMCONVERT | Converts text entered in the edit control from the Windows character set to the OEM character set and then back to the Windows set. This ensures proper character conversion when the application calls the AnsiToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain filenames. |
ES_PASSWORD | Displays all characters as an asterisk (*) as they are typed into the edit control. An application can use the EM_SETPASSWORDCHAR message to change the character that is displayed. |
ES_READONLY | Prevents the user from typing or editing text in the edit control. |
ES_RIGHT | Right aligns text in a multiline edit control. |
ES_UPPERCASE | Converts all characters to uppercase as they are typed into the edit control. |
ES_WANTRETURN | Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If this style is not specified, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control. |
Following are the list box styles (in the LISTBOX class) that an application can specify in the dwStyle parameter:
Style | Meaning |
LBS_DISABLENOSCROLL | Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If this style is not specified, the scroll bar is hidden when the list box does not contain enough items. |
LBS_EXTENDEDSEL | Allows multiple items to be selected by using the SHIFT key and the mouse or special key combinations. |
LBS_HASSTRINGS | Specifies that a list box contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the LB_GETTEXT message to retrieve the text for a particular item. By default, all list boxes except owner-drawn list boxes have this style. An application can create an owner-drawn list box either with or without this style. |
LBS_MULTICOLUMN | Specifies a multicolumn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns. |
LBS_MULTIPLESEL | Turns string selection on or off each time the user clicks or double-clicks the string. Any number of strings can be selected. |
LBS_NOINTEGRALHEIGHT | Specifies that the size of the list box is exactly the size specified by the application when it created the list box. Normally, Windows sizes a list box so that the list box does not display partial items. |
LBS_NOREDRAW | Specifies that the list box's appearance is not updated when changes are made. This style can be changed at any time by sending a WM_SETREDRAW message. |
LBS_NOTIFY | Notifies the parent window with an input message whenever the user clicks or double-clicks a string. |
LBS_OWNERDRAWFIXED | Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are the same height. The owner window receives a WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when a visual aspect of the list box changes. |
LBS_OWNERDRAWVARIABLE | Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height. The owner window receives a WM_MEASUREITEM message for each item in the list box when the list box is created and a WM_DRAWITEM message whenever the visual aspect of the list box changes. |
LBS_SORT | Sorts strings in the list box alphabetically. |
LBS_STANDARD | Sorts strings in the list box alphabetically. The parent window receives an input message whenever the user clicks or double-clicks a string. The list box has borders on all sides. |
LBS_USETABSTOPS | Allows a list box to recognize and expand tab characters when drawing its strings. The default tab positions are 32 dialog box units. (A dialog box unit is a horizontal or vertical distance. One horizontal dialog box unit is equal to one-fourth of the current dialog box base width unit. The dialog box base units are computed based on the height and width of the current system font. The GetDialogBaseUnits function returns the current dialog box base units in pixels.) |
LBS_WANTKEYBOARDINPUT | Specifies that the owner of the list box receives WM_VKEYTOITEM or WM_CHARTOITEM messages whenever the user presses a key and the list box has the input focus. This allows an application to perform special processing on the keyboard input. If a list box has the LBS_HASSTRINGS style, the list box can receive WM_VKEYTOITEM messages but not WM_CHARTOITEM messages. If a list box does not have the LBS_HASSTRINGS style, the list box can receive WM_CHARTOITEM messages but not WM_VKEYTOITEM messages. |
Following are the scroll bar styles (in the SCROLLBAR class) that an application can specify in the dwStyle parameter:
Style | Meaning |
SBS_BOTTOMALIGN | Aligns the bottom edge of the scroll bar with the bottom edge of the rectangle defined by the following CreateWindow parameters: x, y, nWidth, and nHeight. The scroll bar has the default height for system scroll bars. Used with the SBS_HORZ style. |
SBS_HORZ | Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor SBS_TOPALIGN style is specified, the scroll bar has the height, width, and position specified by the CreateWindow parameters. |
SBS_LEFTALIGN | Aligns the left edge of the scroll bar with the left edge of the rectangle defined by the CreateWindow parameters. The scroll bar has the default width for system scroll bars. Used with the SBS_VERT style. |
SBS_RIGHTALIGN | Aligns the right edge of the scroll bar with the right edge of the rectangle defined by the CreateWindow parameters. The scroll bar has the default width for system scroll bars. Used with the SBS_VERT style. |
SBS_SIZEBOX | Designates a size box. If neither the SBS_SIZEBOXBOTTOMRIGHTALIGN nor SBS_SIZEBOXTOPLEFTALIGN style is specified, the size box has the height, width, and position specified by the CreateWindow parameters. |
SBS_SIZEBOXBOTTOMRIGHTALIGN | Aligns the lower-right corner of the size box with the lower-right corner of the rectangle specified by the CreateWindow parameters. The size box has the default size for system size boxes. Used with the SBS_SIZEBOX style. |
SBS_SIZEBOXTOPLEFTALIGN | Aligns the upper-left corner of the size box with the upper-left corner of the rectangle specified by the following CreateWindow parameters: x, y, nWidth, and nHeight. The size box has the default size for system size boxes. Used with the SBS_SIZEBOX style. |
SBS_TOPALIGN | Aligns the top edge of the scroll bar with the top edge of the rectangle defined by the CreateWindow parameters. The scroll bar has the default height for system scroll bars. Used with the SBS_HORZ style. |
SBS_VERT | Designates a vertical scroll bar. If neither the SBS_RIGHTALIGN nor SBS_LEFTALIGN style is specified, the scroll bar has the height, width, and position specified by the CreateWindow parameters. |
Following are the static control styles (in the STATIC class) that an application can specify in the dwStyle parameter. A static control can have only one of these styles.
Style | Meaning |
SS_BLACKFRAME | Specifies a box with a frame drawn in the same color as window frames. This color is black in the default Windows color scheme. |
SS_BLACKRECT | Specifies a rectangle filled with the color used to draw window frames. This color is black in the default Windows color scheme. |
SS_CENTER | Designates a simple rectangle and displays the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next centered line. |
SS_GRAYFRAME | Specifies a box with a frame drawn with the same color as the screen background (desktop). This color is gray in the default Windows color scheme. |
SS_GRAYRECT | Specifies a rectangle filled with the color used to fill the screen background. This color is gray in the default Windows color scheme. |
SS_ICON | Designates an icon displayed in the dialog box. The given text is the name of an icon (not a filename) defined elsewhere in the resource file. The nWidth and nHeight parameters are ignored; the icon automatically sizes itself. |
SS_LEFT | Designates a simple rectangle and displays the given text left-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next left-aligned line. |
SS_LEFTNOWORDWRAP | Designates a simple rectangle and displays the given text left-aligned in the rectangle. Tabs are expanded but words are not wrapped. Text that extends past the end of a line is clipped. |
SS_NOPREFIX | Prevents interpretation of any & characters in the control's text as accelerator prefix characters (which are displayed with the & removed and the next character in the string underlined). This static control style may be included with any of the defined static controls. |
You can combine SS_NOPREFIX with other styles by using the bitwise OR operator. This is most often used when filenames or other strings that may contain an & need to be displayed in a static control in a dialog box. | |
SS_RIGHT | Designates a simple rectangle and displays the given text right-aligned in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next right-aligned line. |
SS_SIMPLE | Designates a simple rectangle and displays a single line of text left-aligned in the rectangle. The line of text cannot be shortened or altered in any way. (The control's parent window or dialog box must not process the WM_CTLCOLOR message.) |
SS_WHITEFRAME | Specifies a box with a frame drawn in the same color as window backgrounds. This color is white in the default Windows color scheme. |
SS_WHITERECT | Specifies a rectangle filled with the color used to fill window backgrounds. This color is white in the default Windows color scheme. |
Following are the dialog box styles an application can specify in the dwStyle parameter:
Style | Meaning |
DS_LOCALEDIT | Specifies that edit controls in the dialog box will use memory in the application's data segment. By default, all edit controls in dialog boxes use memory outside the application's data segment. This feature may be suppressed by adding the DS_LOCALEDIT flag to the Style command for the dialog box. If this flag is not used, EM_GETHANDLE and EM_SETHANDLE messages must not be used, because the storage for the control is not in the application's data segment. This feature does not affect edit controls created outside of dialog boxes. |
DS_MODALFRAME | Creates a dialog box with a modal dialog box frame that can be combined with a title bar and System menu by specifying the WS_CAPTION and WS_SYSMENU styles. |
DS_NOIDLEMSG | Suppresses WM_ENTERIDLE messages that Windows would otherwise send to the owner of the dialog box while the dialog box is displayed. |
DS_SYSMODAL | Creates a system-modal dialog box. |