Create a GUI window.
GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )
Parameters
| title | The title of the dialog box. |
| width | [optional] The width of the window. |
| height | [optional] The height of the window. |
| left | [optional] The left side of the dialog box. By default (-1), the window is centered. If defined, top must also be defined. |
| top | [optional] The top of the dialog box. Default (-1) is centered |
| style | [optional] defines the style of the window. See GUI Control Styles Appendix. Use -1 for the default style which includes a combination of $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU styles. Some styles are always included: $WS_CLIPSIBLINGS, and $WS_SYSMENU if $WS_MAXIMIZEBOX or $WS_SIZEBOX is specified. |
| exStyle | [optional] defines the extended style of the window. See the Extended Style Table below. -1 is the default. |
| parent | [optional] The handle of another previously created window - this new window then becomes a child of that window. |
Return Value
| Success: | Returns a windows handle. |
| Failure: | Returns 0 if the window cannot be created and sets @error to 1. |
Remarks
By default the dialog box is non sizable and non maximizable. So WS_SIZEBOX or WS_MAXIMIZEBOX can be used in the style parameter.| Extended Style | result |
| $WS_EX_ACCEPTFILES | Allow an edit or input control within the created GUI window to receive filenames via drag and drop. The control must have also the $GUI_DROPACCEPTED state set by GUICtrlSetState. for other controls the drag&drop info can be retrieved with @GUI_DRAGID, @GUI_DRAGFILE, @GUIDROPID. |
| $WS_EX_APPWINDOW | Forces a top-level window onto the taskbar when the window is visible. |
| $WS_EX_CLIENTEDGE | Specifies that a window has a border with a sunken edge. |
| $WS_EX_CONTEXTHELP | Includes a question mark in the title bar of the window. Cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX. |
| $WS_EX_DLGMODALFRAME | Creates a window that has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the style parameter. |
| $WS_EX_MDICHILD | Create a child window included in its parent window (simulation not real MDI). |
| $WS_EX_OVERLAPPEDWINDOW | Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles. |
| $WS_EX_STATICEDGE | Creates a window with a three-dimensional border style intended to be used for items that do not accept user input. |
| $WS_EX_TOPMOST | Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. |
| $WS_EX_TRANSPARENT | The window appears transparent because the bits of underlying sibling windows have already been painted. |
| $WS_EX_TOOLWINDOW | Creates a tool window; that is, a window 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 box 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 typing ALT+SPACE. |
| $WS_EX_WINDOWEDGE | Specifies that a window has a border with a raised edge. |
| $WS_EX_LAYERED | Creates a layered window. Note that this cannot be used for child windows. |
Related
GUISetParameters..., GUICtrlCreate..., GUIGetMsg, GUISwitch, GUIGetStyle, GUIDelete, WinGetHandle, GUICtrlSetDefBkColor, GUICtrlSetDefColor, GUIGetCursorInfo
Example
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Example1()
Example2()
; example 1
Func Example1()
Local $msg
GUICreate("My GUI") ; will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
EndFunc ;==>Example1
; example 2
Func Example2()
Local $gui, $background, $pic, $basti_stay, $msg
Local $sFile = "..\GUI\logo4.gif"
$gui = GUICreate("Background", 400, 100)
; background picture
$background = GUICtrlCreatePic("..\GUI\msoobe.jpg", 0, 0, 400, 100)
GUISetState(@SW_SHOW)
; transparent MDI child window
$pic = GUICreate("", 169, 68, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
; transparent pic
$basti_stay = GUICtrlCreatePic($sFile, 0, 0, 169, 68)
GUISetState(@SW_SHOW)
Do
$msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE
EndFunc ;==>Example2