# Function Reference

GUICreate

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.
As defining only one style just set this style don't forget to combine it with default ones, i.e. just defining WS_SIZEBOX will not set WS_MINIMIZEBOX, WS_CAPTION, WS_POPUP, WS_SYSMENU. So the best method to define a resizeable window is to use WS_OVERLAPPEDWINDOW.
When using $WS_EX_MDICHILD the position is relative to client area of the parent window. With $WS_EX_LAYERED it is possible to have a transparent pic on a background pic defined in the parent window.
To combine styles with the default style use BitOr($GUI_SS_DEFAULT_GUI, newstyle,...).
Extended Style table

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.

To use the values specified above you must #include <GUIConstants.au3> in your script.
Note: The handle returned from this function is a real windows handle, which means it can be used in the same way as the result of WinGetHandle.

Related

GUISet..., GUICtrlCreate..., GUIGetMsg, GUIDelete, WinGetHandle

Example

; example 1
#include <GUIConstants.au3>
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
; example 2
#include <GUIConstants.au3>
$gui=GUICreate("Background", 800, 300)
; background picture
$background = GUICtrlCreatePic ("demo-bg.jpg", 0, 0, 800, 300)
GUISetState(@SW_SHOW)
; transparent child window
$pic=GUICreate("", 14, 80, 0, 0,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_MDICHILD,$gui)
; transparent pic
$basti_stay = GUICtrlCreatePic ("l_st.gif", 0, 0, 14, 80)
GUISetState(@SW_SHOW)
do
$msg = GUIGetMsg()
until $msg = $GUI_EVENT_CLOSE