The difference between CreateWindowEx and CreateWindow

Source: Internet
Author: User
Tags unsupported

CreateWindowEx function Function:This function creates an overlapping window with an extended style, a pop-up window, or a child window, and the other is the same as the CreateWindow function. For information about creating windows and other parameters, see CreateWindowEx.
Function prototypes: HWND CreateWindowEx (DWORD dwexstle,lpctstr ipclassname,lpctstr lpwindowname,dword dwstyle,int x,int y,int nWidth, int Nheight,hwnd hwndparent,hmenuhmenu,handle Hlnstance,lpvoidlpparam);
Parameters:
dwExStyle: Specifies the extended style of the window. The parameter can be the following value:
Ws_ex_acceptfiles: Specifies that a window created in that style accepts a drag-and-drop file.
Ws_ex_appwindow: When the window is visible, place a top-level window on the task bar.
Ws_ex_clientedge: Specifies that the window has a shaded boundary.
Ws_ex_contexthelp: The title bar of the window contains a question mark flag. When the user taps the question mark, the mouse cursor becomes a pointer to a question mark, and if a child window is clicked, the WM_HELP message is received on the Child-window day. The child window should pass this message to the parent window procedure, and the parent window calls the WinHelp function through the help_wm_help command. This Help application displays a pop-up window with child window helper information. Ws_ex_contexthelp cannot be used in conjunction with Ws_maximizebox and Ws_minimizebox.
Ws_ex_controlparent: Allows the user to use the TAB key to search between child windows of a window.
Ws_ex_dlgmodalframe: Create a window with a double-sided window that allows you to specify a ws_caption style in Dwstyle to create a title bar.
Ws_ex_left: The window has the left alignment property, which is the default setting.
Ws_ex_leftscrollbar: If the shell language is such as hebrew,arabic, or other language that supports reading order alignment, then the title bar (if present) is in the left part of the client area. If other languages are ignored in this style and are not handled as errors.
Ws_ex_ltrreading: The window text is displayed in the order of left-to-right properties. This is the default setting.
Ws_ex_mdichild: Creates an MD child window.
Ws_ex_nopatarentnotify: Indicates that a window created in this style does not send a WM_PARENTNOTFY message to the parent window when it is created and destroyed.
Combination of Ws_ex_overlapped:ws_ex_clientedge and Ws_ex_windowedge.
Ws_ex_palettewindow:ws_ex_windowedge, Ws_ex_toolwindow, and ws_wx_topmost-style combinations ws_ex_right: windows have normal right-aligned properties, which depend on the window class. This style is only valid if the shell language is a language such as hebrew,arabic or other languages that support read order alignment (reading order alignment), otherwise the flag is ignored and is not handled as an error.
Ws_ex_rightscrollbar: Vertical scroll bar at the right edge of the window. This is the default setting.
Ws_ex_rtlreading: If the shell language is a language such as hebrew,arabic, or other languages that support read order alignment (reading order alignment), then the window text is a left-to-right, and the read-out order is to the leftmost order. If other languages are ignored in this style and are not handled as errors.
Ws_ex_staticedge: Create a 31-D boundary style for items that do not accept user input
Ws_ex_toolwidow: Creates a tool window, where the window is a roving bar. The title bar of the tool window is shorter than the title bar of the normal window, and the window caption is displayed in a small font. The tool window is not displayed in the taskbar, and the tool window is not displayed in the dialog box when the user presses ALT + TAB. If the tool window has a system menu, its icon will not be displayed in the title bar, however, you can click the right mouse button or Alt+space to display the menu.
Ws_ex_topmost: Indicates that a window created with this style should be placed above all non-top-level windows and remain in its L, even if the window is not activated. Use the function SetWindowPos to set and remove this style.
Ws_ex_transparent: Specifies that a window created in this style can be redrawn when the same-owned window under the window has been redrawn.
The window is transparent because it has been redrawn under the same rich day.
Ipclassname: points to a null-terminated string or an integer atom. If the parameter is an integer, it is the global amount produced by the previous call to the Theglobaiaddatom function. This 16-digit number smaller than oxcooo must be a low 16-bit of the ipclassname parameter word, and the high-key must be O.
If Lpclassname is a string, it specifies the window's class name. This class name can be any class name registered with the function registerclassex, or any predefined control class name. See the list in the Description section.
Lpwindowname: Pointer to a string that specifies the empty end of the window name.
If the window style specifies a title bar, the window caption pointed to by Lpwindowname is displayed on the title bar. When using CreateWindow
function to create controls such as buttons, selection boxes, and static controls, you can use Lpwindowname to specify control text.
Dwstyle: Specifies the style of the creation window. This parameter can be a combination of the following window styles plus the control style of the description section.
x: See CreateWindow.
Y: See CreateWindow.
Nwidth:createwindow.
Nheigth: See CreateWindow.
hWndParent: See CreateWindow.
HMenu: See CreateWindow.
Hlnstance: See CreateWindow.
Lpparam: See CreateWindow.
return value: See CreateWindow.
Note: See CreateWindow.
Quick check: Windows nt:3.1 above version; windows:95 or above; windows ce:1.0 or above; header: winuser.h; library file: USer32.lib; Unicode: Implemented as Unicode and ANSI two versions on Windows NT.

-----------------------------------------------------------------------------------------
CreateWindow function: This function creates an overlapping window, a pop-up window, or a sub-window. It specifies the window class, window caption, window style, and the initial position and size of the window (optional). The function also specifies the window's parent window or its owning window (if one exists), and the window's menu. To use an out-of-style extension style that is supported by the CreateWindow function, use the CREATEWINDOWEX function instead of the CreateWindow function.
Function prototype: HWND CreateWindow (lpctstr lpclassname,lpctstr lpwindowname,dword dwstyle,int x,int y,int nwidth,int Nheight,hwnd Hwndparent,hmenu hmenu,handle hlnstance,lpvoid Lpparam);
Parameters:
Lpclassname: points to a null-terminated string or an integer atom. If the parameter is an integer, it is the global amount produced by the previous call to the Theglobaladdatom function. This 16-digit number less than 0xc000 must be a low 16-bit of the lpclassname parameter word, and the high position of this parameter must be 0.
If Lpclassname is a string, it specifies the window's class name. This class name can be any class name registered with the function registerclassex, or any predefined control class name. See the list in the Description section.
Lpwindowname: Pointer to a string that specifies the empty end of the window name.
If the window style specifies a title bar, the window caption pointed to by Lpwindowname is displayed on the title bar. When you use the CreateWindow function to create controls such as buttons, selection boxes, and static controls, you can use Lpwindowname to specify control text.
Dwstyle: Specifies the style of the creation window. This parameter can be a combination of the following window styles plus the control style of the description section. Style meaning:
Ws_border: Creates a single-border window.
Ws_caption: Creates a window with a title box (including Ws_boder style).
Ws_child: Creates a child window. This style cannot be combined with the ws_popup style.
Ws_chldwindow: Same as Ws_child.
Ws_clipchildren: Excludes the child window area when drawing within the parent window. Use this style when creating a parent window.
ws_cllpblings; excludes the relative area between child windows, that is, when a particular window receives a WM_PAINT message, the ws_clipsiblings style excludes all cascading windows from the drawing and redraws only the specified child window. If the ws_clipsiblings style is not specified and the child window is stacked, the neighboring child window is redrawn when the client area of the child window is redrawn.
Ws_disabled: Creates a child window with an initial state of forbidden. A disabled window day cannot accept input from the user.
Ws_dlgframe: Creates a window with the border style of the dialog box. This style of window cannot be brought with the title bar.
Ws_group: Specifies the first control of a group of controls. This control group consists of the first control and subsequently defined controls, each control starting from the second control, with a ws_group style, and the first control of each group with the Ws_tabstop style, allowing the user to move between groups. The user can then use the cursor to change keyboard focus between controls within the group.
Ws_hscroll: Creates a window with a horizontal scroll bar.
Ws_iconic: Creates a window with an initial state of minimized state. Same as the ws_minimize style.
Ws_maximize: Creates a window with a maximize button. This style does not appear at the same time as the Ws_ex_contexthelp style and must be specified Ws_sysmenu style.
Ws_overlapped: Produces a cascade of Windows. A cascading window has a title bar and a border. Same as the ws_tiled style.
Ws_overlappedwindow: Create a cascade window with Ws_overlapped,ws_caption,ws_sysmenu ws_thickframe,ws_minimizebox,ws_maxmizebox style , the same as the Ws_tiledwindow style.
Ws_popup; Create a pop-up window. This style cannot be used in conjunction with the WS_CHLD style.
Ws_popuwindow: Create a window with Ws_border,ws_popup,ws_sysmenu style, ws_caption and Ws_popupwindow must be set at the same time to make the window a single visible.
Ws_sizebox: Creates a window with an adjustable border, the same as the Ws_thickframe style.
Ws_sysmenu: To create a window with a Window menu on the title bar, you must also set the Ws_caption style.
Ws_tabstop: Creates a control that gives the keyboard focus when the user presses the TAB key. Press the TAB key to move the keyboard focus to the next control with ws_tabstop style.
Ws_thickframe: Creates a window with an adjustable border, the same as the Ws_sizebox style.
Ws_tiled: Produces a cascade of Windows. A cascading window has a caption and a border. Same as the ws_overlapped style.
Ws_tiledwindow: Create a ms_thickframe with Ws_overlapped,ws_caption,ws_sysmenu.
Ws_minimizebox,ws_maxmizebox-style cascading windows. Same as the Ws_overlappedwindow style.
Ws_visible: Creates a window with an initial state of visible. Ws_vscroll: Creates a window with a vertical scroll bar.
X: Specifies the initial horizontal position of the window. For a cascading or pop-up window, the x parameter is the initial x-coordinate of the upper-left corner of the window in the screen coordinate system. For a child rich port, X is the initial x-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. If the parameter is set to Cw_ucedefault, the system selects the default upper-left coordinate for the window and ignores the y parameter. Cw_usedefault is only valid for cascading windows, and if set for a pop-up window or Subwindow, the x and Y parameters are set to zero.
Y: Specifies the initial vertical position of the window. For a cascading or pop-up window, the y parameter is the initial y-coordinate of the upper-left corner of the window in the screen coordinate system. For child windows, Y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box, Y is the initial y-coordinate of the upper-left corner of the list box client area relative to the upper-left corner of the parent window's client area. If the Cascade window is created using the ws_visible style bit and the x parameter is set to Cw_usedefault, the y parameter is ignored.
Nwidth: Indicates the width of the window in device units. For cascading windows, nwidth or screen coordinates of the window width or cw_usedefault. If Nwidth is Cw_usedefault, the system selects a default height and width for the window: The default width is from the initial X coordinate to the right edge of the screen, and the default height is from the initial X coordinate to the top of the target area. Cw_usedfeault is only valid for cascading windows, and nwidth and nheight are set to zero if the CW_USEDEFAULT flag is set for pop-up windows and child windows.
Nhelght: Indicates the height of the window in device units. For cascading windows, nheight is the window width of the screen coordinates. If Nwidth is set to Cw_usedefault, the system ignores the nheight parameter.
hWndParent: The handle of the parent window or owner window that points to the window being created. To create a child window or a owned window, you need to provide a valid window handle. This parameter is optional for pop-up window days. Windows NT 5.0; Creates a message window that can provide hwnd_message or provide a handle to a message window that already exists.
HMenu: A menu handle, or a subwindow identifier, according to the window style. For cascading or pop-up windows, Hmenu specifies the menu used by the window: if a menu class is used, hmenu can be null. For a child window, hmenu specifies the child window identifier (an integer), and a dialog box uses this integer value to notify the parent class of the event. The application determines the child window identity, which must be unique for all child windows of the same parent window.
Hlnstance: A handle to the module case associated with the window.
Lpparam: A pointer to a value that is passed to the window wm_create message. This value is passed through the CREATESTRUCT structure in the Iparam parameter. If the application calls CreateWindow to create an MDI client window, the Lpparam must point to a clientcreatestruct structure.
Return value: If the function succeeds, the return value is a handle to the new window: If the function fails, the return value is null. To get more error information, call the GetLastError function.
Note: Before returning, CreateWindow sends a WM_CREATE message to the window procedure. For cascading, pop-up and Subwindow, CreateWindow sends Wm_create,wm_getminmaxinfo and wm_nccreate messages to the window. The Iparam parameter of the message wm_create contains a pointer to the CREATESTRUCT structure. If the ws_visible style is specified, CreateWindow sends all messages to the window that need to be activated and displayed.
Gets control information about whether the task bar displays a button for the created window, see visbility for the taskbar button.
The following predefined control classes can be specified in the Lpclassname parameter. Note the corresponding control style that can be used in the dwstyle parameter.
button buttons are a small rectangular subwindow that the user can click to turn on or off. Button controls can be used alone or included in groups, and can be used to write labels or not write labels for controls. When the user clicks the button control, the appearance of the button changes significantly. Please refer to button. Refer to the button style table for the buttons that are specified in the dwstyle parameter.
A ComboBox combo box consists of a list box and a selection field similar to edit control. When using this style control, the application either keeps the list box displayed or is made into a drop-down list. If the list box is visible, entering a character in the edit field will highlight the first field in the list box that matches the character. Conversely, the item selected in the list box is displayed in the Edit field. See Combo Boxes.
See combo Boxes style for the combo box style table specified in the dwstyle parameter.
edit box A small Rectangle child window The user can use the keyboard to enter text into it. The user can click or press the TAB key to check the edit box control and have the control focus. When a flashing caret is displayed in the edit box, the user can enter text. Use the mouse to move the cursor, select the character to be replaced or set the position of the insertion character or use the fallback key to delete the character. Please see edit. Controls
See edit Control style for a table that specifies the style of the editing box specified in the dwstyle parameter.
A list of ListBox string strings. A list box can be specified when the application must display a list of names, such as the file name lists, so that the user can choose from. The user can click to select the name. When selected, the selected name is highlighted, and a notification message is passed to the parent window. See list Box Style. Refer to list box Control style for listing style tables specified in the dwstyle parameter.
Mdiclient MDI Client designs the MDI client window. The window receives a message that controls the child window of the MDI application. Two control style bits are recommended: Ws_clipchildren and Ws_child. MDI client windows that specify the Ws_hscroll and Ws_vscroll styles allow the user to slide the MDI child window into the window. See MDI.
RichEdit designed a rich editl.0 version of the control. This control enables users to navigate and edit text in character and paragraph formats, and can contain embedded COM objects. See Rich Edit Controls. Refer to the list box Control style for the RichEdit style table specified in the dwstyle parameter.
RICHEDIT class designs A rich Edik2.0 version of the control. This control enables users to navigate and edit text in character and paragraph formats, and can contain embedded COM objects. Please see Richeditcontrols. Refer to Richeditcontroistyle for the RichEdit style table specified in the dwstyle parameter.
A SCROLLBAR scroll bar design contains a scroll box and a rectangle with directional arrows at both ends. The scroll bar sends a notification message to the parent window whenever the user taps the control. If necessary, the parent window is responsible for updating the position of the scroll bar. Please see scrollbars. See scroll Bars style for the scroll bar style table specified in the dwstyle parameter.
A simple static text field, a text box or rectangle used to label controls, combine controls, or separate controls from other controls.
Static control does not provide input and also does not provide output. See Static Control Styles. Refer to scroll Bars style for the static Text style table specified in the dwstyle parameter.
WINDOWS95: The system can support a maximum of 16,364 window handles.
Note: If a Windows 4.x version is indicated when the application is linked, the window control does not have caption control unless the application's window has a single window. There is no such requirement for the windows3.x version.
Windows Ce:createwindow is done in a "macro" manner. It is defined as CreateWindowEx, and the dwExStyle parameter is set to a long integer of 0. Menu bar control is not supported unless it is declared as a child window flag otherwise the HMENU parameter must be null. Mdiclient window classes are not supported. The dwstyle parameter can be a combination of window styles and control styles in a dialog box (dialogue box), window (Windows), control (controls) file.
The following dwstyle flags are not supported in Windows:
Ws_childwindow ws_iconc;ws_maxmize ws_maximizebox;ws_minimize Ws_minimizebox;
Ws_overlappedwindow ws_popupwindow;ws_sizeboxws_thickframe ws_tiled Ws_tiledwindow
The following dwstyle flags are not supported in the control and dialog boxes:
Unsupported button style and static control style:
Bs_lefttext ss_blackframe;bs_multiline ss_grayframe bs_text Ss_metapict;bs_userbutton SS_SIMPLE
Combo box Ss_whiterect style is not supported.
cbs_ownerdrawfixed ss_blackrect;cbs_ownwedrawvariable ss_grayrect cbs_simple8r old Htrimage
list box control Ss_whiteframe style is not supported.
Lbs_nodata
Unsupported dialog-box style:
Lbs_ownerdrawfixed ds_absalign; lbs_ownerdrawvariable ds_centermouse; Lbs_standard DS_CONTEXTHELP
Ds_fixedsys style for scroll bars not supported
Sbs_bottomalign ds_nofailcreate;sbs_rightalign ds_noidlemsg;
Sbs_slzeboxbott0mrihtalign Ds_sysmodal;sbs_sizegrip
The Bs_ownerdraw style can be used instead of the Bs_userbutton style.
The Ss_left or Ss_leftnowordwrap style can be used instead of the ss_simple style of static control.
Mdiclient window classes are not supported.
All windows are implicitly ws_clipsiblings and Ws_clipchildren style.
Windows CE1.0 does not support the genus window except the dialog box. If the hwndparent parameter is not NULL, the window implicitly gives the Ws_child style. Windows CE1.0 does not support menu bars.
Quick check: Windows nt:3.1 or above version; windows:95 or above; windows ce:1.0 or above; header file: winuser.h; library file: User32.lib; Unicode: In Windows Implemented as Unicode and ANSI two versions on NT.

--------------------------------------------------------------

Reference:

Http://zhidao.baidu.com/question/84273061.html

Where Delphi uses only the CreateWindowEx function, and does not use the CreateWindow function once.
After the time, try these different styles have what effect ~ now is for reference, explanation is clear enough.

The difference between CreateWindowEx and CreateWindow

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.