易语言API学习和CreateWindowExA

函数原型:

CreateWindowExA function (winuser.h) | Microsoft Docs https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-createwindowexa

HWND CreateWindowExA(
  DWORD     dwExStyle,
  LPCSTR    lpClassName,
  LPCSTR    lpWindowName,
  DWORD     dwStyle,
  int       X,
  int       Y,
  int       nWidth,
  int       nHeight,
  HWND      hWndParent,
  HMENU     hMenu,
  HINSTANCE hInstance,
  LPVOID    lpParam
);

参数

dwExStyle:指定窗口的扩展风格。该参数可以是下列值:

Extended Window Styles - Windows applications | Microsoft Docs https://docs.microsoft.com/zh-cn/windows/desktop/winmsg/extended-window-styles

The following are the extended window styles.
 
Constant/value	Description
WS_EX_ACCEPTFILES
0x00000010L
The window accepts drag-drop files.
WS_EX_APPWINDOW
0x00040000L
Forces a top-level window onto the taskbar when the window is visible. 
WS_EX_CLIENTEDGE
0x00000200L
The window has a border with a sunken edge.
WS_EX_COMPOSITED
0x02000000L
Paints all descendants of a window in bottom-to-top painting order using double-buffering. For more information, see Remarks. This cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC. 
Windows 2000: This style is not supported.
WS_EX_CONTEXTHELP
0x00000400L
The title bar of the window includes a question mark. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.
WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
WS_EX_CONTROLPARENT
0x00010000L
The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
WS_EX_DLGMODALFRAME
0x00000001L
The window has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter.
WS_EX_LAYERED
0x00080000
The window is a layered window. This style cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.
Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.
WS_EX_LAYOUTRTL
0x00400000L
If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the horizontal origin of the window is on the right edge. Increasing horizontal values advance to the left. 
WS_EX_LEFT
0x00000000L
The window has generic left-aligned properties. This is the default.
WS_EX_LEFTSCROLLBAR
0x00004000L
If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored.
WS_EX_LTRREADING
0x00000000L
The window text is displayed using left-to-right reading-order properties. This is the default.
WS_EX_MDICHILD
0x00000040L
The window is a MDI child window.
WS_EX_NOACTIVATE
0x08000000L
A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.
The window should not be activated through programmatic access or via keyboard navigation by accessible technology, such as Narrator.
To activate the window, use the SetActiveWindow or SetForegroundWindow function.
The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.
WS_EX_NOINHERITLAYOUT
0x00100000L
The window does not pass its window layout to its child windows.
WS_EX_NOPARENTNOTIFY
0x00000004L
The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed.
WS_EX_NOREDIRECTIONBITMAP
0x00200000L
The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.
WS_EX_OVERLAPPEDWINDOW
(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
The window is an overlapped window.
WS_EX_PALETTEWINDOW
(WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
The window is palette window, which is a modeless dialog box that presents an array of commands. 
WS_EX_RIGHT
0x00001000L
The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored.
Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles. 
WS_EX_RIGHTSCROLLBAR
0x00000000L
The vertical scroll bar (if present) is to the right of the client area. This is the default.
WS_EX_RTLREADING
0x00002000L
If the shell language is Hebrew, Arabic, or another language that supports reading-order alignment, the window text is displayed using right-to-left reading-order properties. For other languages, the style is ignored.
WS_EX_STATICEDGE
0x00020000L
The window has a three-dimensional border style intended to be used for items that do not accept user input.
WS_EX_TOOLWINDOW
0x00000080L
The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE. 
WS_EX_TOPMOST
0x00000008L
The window should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.
WS_EX_TRANSPARENT
0x00000020L
The window should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.
To achieve transparency without these restrictions, use the SetWindowRgn function.
WS_EX_WINDOWEDGE
0x00000100L
The window has a border with a raised edge.

WS_EX_ACCEPTFILES:指定以该风格创建的窗口接受一个拖拽文件。
WS_EX_APPWINDOW:当窗口可见时,将一个顶层窗口放置到任务条上。
WS_EX_CLIENTEDGE:指定窗口有一个带阴影的边界。
WS_EX_CONTEXTHELP:在窗口的标题条包含一个问号标志。当用户点击了问号时,鼠标光标变为一个问号的指针、如果点击了一个子窗口,则子窗日接收到WM_HELP消息。子窗口应该将这个消息传递给父窗口过程,父窗口再通过HELP_WM_HELP命令调用WinHelp函数。这个Help应用程序显示一个包含子窗口帮助信息的弹出式窗口。 WS_EX_CONTEXTHELP不能与WS_MAXIMIZEBOX和WS_MINIMIZEBOX同时使用。
WS_EX_CONTROLPARENT:允许用户使用Tab键在窗口的子窗口间搜索。
WS_EX_DLGMODALFRAME:创建一个带双边的窗口;该窗口可以在dwStyle中指定WS_CAPTION风格来创建一个标题栏。
WS_EX_LEFT:窗口具有左对齐属性,这是缺省设置的。
WS_EX_LEFTSCROLLBAR:如果外壳语言是如Hebrew,Arabic,或其他支持reading order alignment的语言,则标题条(如果存在)则在客户区的左部分。若是其他语言,在该风格被忽略并且不作为错误处理。
WS_EX_LTRREADING:窗口文本以LEFT到RIGHT(自左向右)属性的顺序显示。这是缺省设置的。
WS_EX_MDICHILD:创建一个MD子窗口。
WS_EX_NOPATARENTNOTIFY:指明以这个风格创建的窗口在被创建和销毁时不向父窗口发送WM_PARENTNOTFY消息。
WS_EX_OVERLAPPED:WS_EX_CLIENTEDGE和WS_EX_WINDOWEDGE的组合。
WS_EX_PALETTEWINDOW:WS_EX_WINDOWEDGE, WS_EX_TOOLWINDOW和WS_WX_TOPMOST风格的组合WS_EX_RIGHT:窗口具有普通的右对齐属性,这依赖于窗口类。只有在外壳语言是如Hebrew,Arabic或其他支持读顺序对齐(reading order alignment)的语言时该风格才有效,否则,忽略该标志并且不作为错误处理。
WS_EX_RIGHTSCROLLBAR:垂直滚动条在窗口的右边界。这是缺省设置的。
WS_EX_RTLREADING:如果外壳语言是如Hebrew,Arabic,或其他支持读顺序对齐(reading order alignment)的语言,则窗口文本是一自左向右)RIGHT到LEFT顺序的读出顺序。若是其他语言,在该风格被忽略并且不作为错误处理。
WS_EX_STATICEDGE:为不接受用户输入的项创建一个3一维边界风格
WS_EX_TOOLWIDOW:创建工具窗口,即窗口是一个游动的工具条。工具窗口的标题条比一般窗口的标题条短,并且窗口标题以小字体显示。工具窗口不在任务栏里显示,当用户按下alt+Tab键时工具窗口不在对话框里显示。如果工具窗口有一个系统菜单,它的图标也不会显示在标题栏里,但是,可以通过点击鼠标右键或Alt+Space来显示菜单。
WS_EX_TOPMOST:指明以该风格创建的窗口应放置在所有非最高层窗口的上面并且停留在其L,即使窗口未被激活。使用函数SetWindowPos来设置和移去这个风格。
WS_EX_TRANSPARENT:指定以这个风格创建的窗口在窗口下的同属窗口已重画时,该窗口才可以重画。
由于其下的同属富日已被重画,该窗口是透明的。
IpClassName:指向一个空结束的字符串或整型数atom。如果该参数是一个整型量,它是由此前调用theGlobaIAddAtom函数产生的全局量。这个小于OxCOOO的16位数必须是IpClassName参数字的低16位,该参数的高位必须是O。
如果lpClassName是一个字符串,它指定了窗口的类名。这个类名可以是任何用函数RegisterClassEx注册的类名,或是任何预定义的控制类名。请看说明部分的列表。
lpWindowName:指向一个指定窗口名的空结束的字符串指针。
如果窗口风格指定了标题条,由lpWindowName指向的窗口标题将显示在标题条上。当使用CreateWindow
函数来创建控制例如按钮,选择框和静态控制时,可使用lpWindowName来指定控制文本。
dwStyle:指定创建窗口的风格。该参数可以是下列窗口风格的组合再加上说明部分的控制风格。
x:参见CreateWindow。
y:参见CreateWindow。
nWidth:CreateWindow。
nHeigth:参见CreateWindow。
hWndParent:参见CreateWindow。
hMenu:参见CreateWindow。
hlnstance:参见CreateWindow。
lpParam:参见CreateWindow。
返回值:参见CreateWindow。
备注:参见CreateWindow。
速查:Windows NT:3.1以上版本;Windows:95以上版本;Windows CE:1.0以上版本;头文件:winuser.h;库文件:USer32.lib;Unicode:在Windows NT上实现为Unicode和ANSI两种版本

易语言调用

.版本 2
 
.DLL命令 创建窗口, 整数型, "user32.dll", "CreateWindowExA"
    .参数 扩展风格, 整数型
    .参数 类名, 文本型
    .参数 窗口标题, 文本型
    .参数 风格, 整数型
    .参数 屏幕横坐标, 整数型
    .参数 屏幕纵坐标, 整数型
    .参数 宽度, 整数型
    .参数 高度, 整数型
    .参数 父窗口句柄, 整数型
    .参数 菜单句柄, 整数型
    .参数 模块句柄, 整数型
    .参数 参数, 整数型

发布日期:

所属分类: 易语言 标签: