The CreateWindow of Win32 window mechanism

Source: Internet
Author: User
Tags unsupported win32 window

createwindow     Function 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   is present), 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 Prototypes: HWND CreateWindow (lpctstr lpclassname,lpctstr lpwindowname,dword dwstyle,int x,int y, int nwidth,int Nheight,hwnd hwndparent,hmenu hmenu,handle hlnstance,lpvoid lpparam);      Parameter:    lpclassname: points to a null-terminated string or an integer atom. If the parameter is an integer, it is the global amount generated by the previous tune   using the Theglobaladdatom function. This 16-digit number smaller than 0xc000 must be a low 16-bit &nbsp of the lpclassname parameter word, and the high position of the parameter must be 0. If Lpclassname is a string, it specifies the window's class name. This class name can be either the class name registered by the   function registerclassex or any predefined control class name. See the list in the Description section.     lpwindowname: A string pointer to the empty end of a specified window name.      If the window style specifies a title bar, the title of the window 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 in which the window is created. This parameter can be a combination of the following window styles plus the control style of the description section.   Style:    ws_border: Create a single-border window.  &nbsp  ws_caption: Creates a window with a title box (including Ws_border style).     ws_child: Create a child window. This style cannot be combined with the ws_popup style.     ws_childwindow: Same as Ws_child.     ws_clipchildren: Excludes child window areas when drawing within the parent window. Use this style when creating a parent window.     ws_clipsiblings: Excludes the relative area between child windows, that is, when a particular window receives WM_PAINT message  , 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 cannot accept the sender   information from the user.     ws_dlgframe: Creates a window with a 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, starting with each control from the   two controls, with the Ws_group style, the first control of each group with the ws_tabstop style, so that the user   can 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 the initial state minimized. Same as the ws_minimize style.     ws_maximize: Creates a window with an initial state of maximized state.     ws_maximizebox: Creates a window with a maximize button. This style cannot be   present at the same time as the Ws_ex_contexthelp style, and Ws_sysmenu style must be specified.     ws_minimize: Create aA window with an initial state of minimized state. Same as the ws_iconic style.     ws_minimizebox: Creates a window with a minimized button. This style cannot be   present at the same time as the Ws_ex_contexthelp style, and Ws_sysmenu style must be specified.     ws_overlapped: Produces a cascade of Windows. A cascading window has a title bar and a border. Same as ws_tiled wind   grid.     ws_overlappedwindow: Create a Ws_overlapped,ws_caption,ws_sysmenu,ws_thickframe ,ws_ Minimizebox,ws_maxmizebox style cascading windows, 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 key   pan 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 ws_overlapped style  .     ws_tiledwindow: Create a Ws_overlapped,ws_caption,ws_sysmenU Ms_thickframe.     ws_minimizebox,ws_maxmizebox style cascading windows. Same as the Ws_overlappedwindow style.     ws_visible: Creates a window with an initial status 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_usedefault, the system selects the default upper-left coordinate for the window and ignores the y parameter. Cw_usedefault is only valid for cascading Windows,  if the pop-up window or subwindow is set, 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 list boxes, 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   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   starts 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_usedefault only   The Cascade window is valid, if the CW_USEDEFAULT flag is set for pop-up windows and child windows, nwidth and nheight are set to zero.     nheight: 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 window   port, provide a valid window handle. This parameter is optional for pop-up window days. Windows NT 5.0; Creates a message   window that provides a handle to the Hwnd_message or provides a message window that already exists.     hmenu: A menu handle, or a Subwindow identification based on the window style. For cascading or pop-up windows, Hmenu specifies the menu used for the window   port: Hmenu can be null if a menu class is used. For child windows, 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 ID, which must be unique for all child windows of   same parent window.     hinstance: 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 lparam parameter. If an application calls CreateWindow to create an MDI client window, then 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 messages, call the GetLastError function.      NOTE: Before returning, CreateWindow sends a WM_CREATE message to the window procedure. For cascading, pop-up and child windows  ,createwindow send Wm_create,wm_getminmaxinfo and wm_nccreate messages to the window. The  lparam parameter of the message wm_create contains a pointer to the CREATESTRUCT structure. If you specify a ws_visible style, CreateWindow sends all messages that need to be activated and displayed to the window   port.      Gets control information about whether the task bar displays a button for the created window, see the taskbar button's visbility.     the following predefined control classes can be specified in the Lpclassname parameter. Note in DThe corresponding control wind   lattice can be used in the Wstyle parameter.      button: button is a small rectangular subwindow that the user can click to open or close. Button controls can be used alone or in packs   included in groups, which 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   See button. Refer to the button style table for the buttons that are specified in the dwstyle parameter.     combobox: Combo box consisting of a list box and a selection field similar to edit control. &NBSP 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 the word   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.      View the combo box style table specified in the dwstyle parameter, refer to combo Boxes style.     edit: The edit box, a small rectangular subwindow, where the user can enter text using the keyboard. 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 lose   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  .      View the form of the edit box style specified in the dwstyle parameter, refer to edit Control style.     listbox: List box, List of strings. A list box can be specified when the application must display a list of names, such as file name lists, so that users   can select from them. The user can click to select the name. When selected, the selected name is highlighted while passing   a notification message to the parent window. See list Box Style. Refer to List box Control style for the list style table specified in the dwstyle parameter.     mdiclient: The client designs the MDI client window. The window receives a message that controls the child window of the MDI application. Two types of control   style bits are recommended: Ws_clipchildren and Ws_child. MeansWs_hscroll and Ws_vscroll-style MDI client windows allow   to slide MDI child windows into the window. See MDI.     richedit: Design a rich editl.0 version of the control. This control enables users to browse and edit text   texts in character and paragraph format, 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: Design a rich Edik2.0 version of the control. This control enables users to browse and   edit text in character and paragraph format, and can contain embedded COM objects. Please see Richeditcontrols. Refer to Richeditcontroistyle for the  richedit style table specified in the dwstyle parameter.     scrollbar: A scrollbar that is designed to contain 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   controls. 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.     static: A simple static text field in which a text box or rectangle is used to label controls, combine controls, or separate controls from other control   systems.      Static control does not provide input and also does not provide output. See Static Control Styles. Refer to scroll Bars style for static text style tables specified   in the dwstyle parameter.      windows95: The system can support a maximum of 16,364 window handles.       NOTE: If the Windows 4.x version is indicated when the application is linked, the window   port control has no caption control unless the application's windows have a window. There is no such requirement for the windows3.x version.      windows Ce:createwindow is done in "macro" mode. 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. No   hold Mdiclient window class. The dwstyle parameter can be a combination of window styles and control styles in the dialog box (dialogue box), window (Windows), control   (controls) files.      The following dwstyle flag is not supported in Windows:    ws_childwindow;ws_iconic;ws_maximize;ws_maximizebox;ws_ minimize;ws_minimizebox;    ws_overlappedwindow;ws_popupwindow;ws_sizebox;ws_thickframe;ws_tiled ; ws_tiledwindow     The following dwstyle flags are not supported in the controls and dialogs:     Unsupported button style and static control style:    BS_LEFTTEXT;BS_MULTILINE;BS_TEXT;BS_USERBUTTON;     Unsupported static control style: Ss_blackframe;ss_grayframe ; ss_metapict; ss_simple; ss_whiterect;ss_blackrect;ss_grayrect;ss_rightimage;ss_whiteframe  .   combo box style is not supported.     CBS_OWNERDRAWFIXED;CBS_OWNWEDRAWVARIABLE;CBS_SIMPLE     list box control style is not supported.     LBS_NODATA;LBS_OWNERDRAWFIXED;LBS_OWNERDRAWVARIABLE;LBS_STANDARD     Unsupported dialog box style:      Ds_absalign;ds_centermouse;ds_contexthelp;ds_fixedsys;ds_nofailcreate; ds_noidlemsg;ds_sysmodal;     does not support the style of scroll bars      sbs_bottomalign sbs_rightalign;sbs_slzeboxbott0mrihtalign;sbs_sizegrip     can use Bs_ OwnerDraw style to replace Bs_userbutton style.      can use Ss_left or ss_leftnowordwrap style instead of static control ss_simple style.      Mdiclient window classes are not supported.      All windows are implicitly ws_clipsiblings and Ws_clipchildren style.     windows is not supported in the CE1.0 version 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, windows:95 or above, Windows ce:1.0 or above; header file   : winuser.h; library file: User32.lib; Unicode: Implemented as Unicode and ANSI two versions on Windows NT.

CreateWindow of the Win32 window mechanism

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.