see Using Window Classes. Requirements Minimum supported cl

时间:2022-03-27 07:27:18

HWND WINAPI CreateWindow( _In_opt_ LPCTSTR lpClassName, _In_opt_ LPCTSTR lpWindowName, _In_ DWORD dwStyle, _In_ int x, _In_ int y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam );

 改削样式设置style

将窗体设置为 无边框(|WS_POPUP),便利嵌到其他措施里面,一般设置为最大化(WS_MAXIMIZE),如需设置可拖拽(WS_SIZEBOX)。如果需要设置成固定巨细及位置 调解xy坐标及width、height 宽高。

CreateWindow((LPCTSTR)"name", (LPCTSTR)"title", WS_SIZEBOX |WS_POPUP|WS_MAXIMIZE , 0, 0, 500, 600, 0, 0, (HINSTANCE)hWnd, NULL);

下面为一些参考链接

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

https://msdn.microsoft.com/en-us/library/windows/desktop/ms632679(v=vs.85).aspx

CreateWindow function

 

Creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and (optionally) the initial position and size of the window. The function also specifies the window‘s parent or owner, if any, and the window‘s menu.

To use extended window styles in addition to the styles supported by CreateWindow, use the CreateWindowEx function.

Syntax

C++

 

HWND WINAPI CreateWindow( _In_opt_ LPCTSTR   lpClassName, _In_opt_ LPCTSTR   lpWindowName, _In_     DWORD     dwStyle, _In_     int       x, _In_     int       y, _In_     int       nWidth, _In_     int       nHeight, _In_opt_ HWND      hWndParent, _In_opt_ HMENU     hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID    lpParam );

Parameters lpClassName [in, optional]  

Type: LPCTSTR

A null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, provided that the module that registers the class is also the module that creates the window. The class name can also be any of the predefined system class names. For a list of system class names, see the Remarks section.

  lpWindowName [in, optional]  

Type: LPCTSTR

The window name. If the window style specifies a title bar, the window title pointed to by lpWindowName is displayed in the title bar. When using CreateWindow to create controls, such as buttons, check boxes, and static controls, use lpWindowName to specify the text of the control. When creating a static control with the SS_ICON style, use lpWindowName to specify the icon name or identifier. To specify an identifier, use the syntax "#num".

  dwStyle [in]  

Type: DWORD

The style of the window being created. This parameter can be a combination of the window style values, plus the control styles indicated in the Remarks section.

  x [in]  

Type: int

The initial horizontal 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 relative to the upper-left corner of the parent window‘s client area. If this parameter is set to CW_USEDEFAULT, the system 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 it is specified for a pop-up or child window, the x and y parameters are set to zero.

  y [in]  

Type: int

The initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window‘s upper-left corner, in screen coordinates. For a child window, 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‘s client area relative to the upper-left corner of the parent window‘s client area.