Aide:GUICreate.txt

De Wiki AutoIt Français
Aller à : navigation, rechercher

Document original V3.3.6.1 :

###Function###
GUICreate

###Description###
Create a GUI window.

###Syntax###
GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )


###Parameters###
@@ParamTable@@
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 <a href="../appendix/GUIStyles.htm">GUI Control Styles Appendix</a>.
	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 <a href="GUICreate.htm#Extended Style Table">Extended Style Table</a> below.  -1 is the default.
parent
	[optional] The handle of another previously created window - this new window then becomes a child of that window.
@@End@@

###ReturnValue###
@@ReturnTable@@
Success:	Returns a windows handle.
Failure:	Returns 0 if the window cannot be created and sets @error to 1.
@@End@@


###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.
Adding $WS_CLIPCHILDREN style can avoid some flickering when resizing GUI containing Edit control for example.
You can enable window draging for GUI without $WS_CAPTION by using $WS_EX_CONTROLPARENT in the exStyle parameter.

To combine styles with the default style use <b>BitOr</b>($GUI_SS_DEFAULT_GUI, newstyle,...).
The size specified is the size of the client area of the window.  The border and title bar will make the window slightly larger than specified. Using menu controls will also change the windows height.

<a name="Extended Style table"></a><b>Extended Style table</b>
@@StandardTable1@@
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 <a href="GUICtrlSetState.htm">GUICtrlSetState</a>. 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.
@@End@@

To use the values specified above you must #include <WindowsConstants.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###
GUISetParameters..., GUICtrlCreate..., GUIGetMsg, GUISwitch, GUIGetStyle, GUIDelete, WinGetHandle, GUICtrlSetDefBkColor, GUICtrlSetDefColor, GUIGetCursorInfo


###Example###
@@IncludeExample@@


Document traduit V3.3.6.1 :

###Function###
GUICreate

###Description###
Crée une fenêtre GUI.


###Syntax###
GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )


###Parameters###
@@ParamTable@@
title
	Le titre de la boîte de dialogue.
width
	[optionnel] La largeur de la fenêtre.
height
	[optionnel] La hauteur de la fenêtre.
left
	[optionnel] La position du côté gauche de la boîte de dialogue. Par défaut (-1), la fenêtre est centrée. Si défini, la position haute doit également être définie.
top
	[optionnel] La position haute de la boîte de dialogue. Par défaut (-1), la fenêtre est centrée.
style
	[optionnel] définit le style de la fenêtre. Voir <a href="../appendix/GUIStyles.htm">Styles des contrôles GUI</a>.
	Utilisez -1 pour le style par défaut, qui inclut une combinaison des styles $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP et $WS_SYSMENU.
	Certains styles sont toujours inclus: $WS_CLIPSIBLINGS et $WS_SYSMENU si $WS_MAXIMIZEBOX ou $WS_SIZEBOX sont spécifiés.
exStyle
	[optionnel] définit le style étendu de la fenêtre. Voir la <a href="GUICreate.htm#Table des Styles Étendus">Table des Styles Étendus</a> ci-dessous. -1 est la valeur par défaut.
parent
	[optionnel] Le handle d'une fenêtre précédemment créé - La nouvelle fenêtre devient alors un enfant de cette fenêtre.
@@End@@

###ReturnValue###
@@ReturnTable@@
Succès:	Retourne un handle de fenêtre.
Échec:	Retourne 0 si la fenêtre ne peut pas être créé et met @error à 1.
@@End@@


###Remarks###
Par défaut la taille de la boîte de dialogue ne peut pas être modifiée ni maximisée. WS_SIZEBOX ou WS_MAXIMIZEBOX peuvent être utilisés dans le paramètre de style.
La définition d'un seul style n'applique que le style définit, donc n'oubliez pas de le combiner avec les styles par défaut. Si par exemple vous ne définissez que WS_SIZEBOX, alors WS_MINIMIZEBOX, WS_CAPTION, WS_POPUP et WS_SYSMENU ne seront pas utilisés. Donc, la meilleure méthode pour définir une fenêtre redimensionnable est d'utiliser WS_OVERLAPPEDWINDOW.
Lorsque vous utilisez $WS_EX_MDICHILD, la position est relative à la zone client de la fenêtre parent. Avec $WS_EX_LAYERED il est possible d'avoir une image transparente sur une image de fond défini dans la fenêtre parent.
L'ajout du style $WS_CLIPCHILDREN peut éviter un certain scintillement lors du redimensionnement d'une GUI avec par exemple un contrôle Edit.
Vous pouvez activer le déplacement d'une fenêtre sans $WS_CAPTION en utilisant $WS_EX_CONTROLPARENT dans les paramètres étendus (exStyle).

Pour combiner les styles avec les styles par défaut, utilisez <b>BITOR</b>($GUI_SS_DEFAULT_GUI, nouveaustyle, ...).
La taille spécifiée est la taille de la zone cliente de la fenêtre. La bordure et la barre de titre feront que la fenêtre sera légèrement plus grande que la taille spécifiée. L'utilisation de menu de commandes changera aussi la hauteur des fenêtres.

<a name="Table des Styles Étendus"></a><b>Table des Styles Étendus</b>
@@StandardTable1@@
style étendu	résultat
$WS_EX_ACCEPTFILES	Autorise un contrôle Edit ou un contrôle Input dans la fenêtre GUI créée, à recevoir des noms de fichiers par glisser-déposer. Le contrôle doit aussi avoir l'état $GUI_DROPACCEPTED attribué par <a href="GUICtrlSetState.htm">GUICtrlSetState</a>. Pour d'autres contrôles, l'info glisser-déposer peut être récupérée par @GUI_DRAGID, @GUI_DRAGFILE ou @GUIDROPID.
$WS_EX_APPWINDOW	Met la fenêtre au premier plan sur la barre des tâches lorsque la fenêtre est visible.
$WS_EX_CLIENTEDGE	Indique que la fenêtre a une bordure avec un bord creux.
$WS_EX_CONTEXTHELP	Inclut un point d'interrogation dans la barre de titre de la fenêtre. Ne peut être utilisé avec WS_MAXIMIZEBOX ou WS_MINIMIZEBOX.
$WS_EX_DLGMODALFRAME	Crée une fenêtre qui a une double bordure, la fenêtre peut, éventuellement, être créée avec une barre de titre en spécifiant le style WS_CAPTION dans le paramètre de style.
$WS_EX_MDICHILD	Crée une fenêtre enfant incluse dans sa fenêtre parente (simulation, pas rééllement un MDI).
$WS_EX_OVERLAPPEDWINDOW	Combine les styles WS_EX_CLIENTEDGE et WS_EX_WINDOWEDGE.
$WS_EX_STATICEDGE	Crée une fenêtre avec un style de bordure en trois dimensions destiné à être utilisé pour des éléments qui n'acceptent pas les entrées utilisateur.
$WS_EX_TOPMOST	Indique que la fenêtre créée avec ce style doit être placée par-dessus toutes les fenêtres qui ne sont pas d'avant-plan et devrait rester par-dessus, même lorsque la fenêtre est désactivée.
$WS_EX_TRANSPARENT	La fenêtre apparaît transparente car les bits des fenêtres enfant sous-jacentes de même parent ont déjà été peints.
$WS_EX_TOOLWINDOW	Crée une fenêtre outil, qui est une fenêtre destinée à être utilisée comme une barre d'outils flottante. Une fenêtre outil a une barre de titre qui est plus petite que la barre de titre normale, et dont la police du titre est plus petite. Une fenêtre outil n'apparaît pas dans la barre des tâches ou dans la boîte de dialogue qui s'affiche lorsque l'utilisateur appuie sur ALT+TAB. Si une fenêtre outil dispose d'un menu système, son icône n'est pas affichée dans la barre de titre. Cependant, vous pouvez afficher le menu système en tapant ALT+ESPACE.
$WS_EX_WINDOWEDGE	Indique que la fenêtre a une bordure en relief.
$WS_EX_LAYERED	Crée une fenêtre de superposition (alphablend). Notez que cela ne peut pas être utilisé pour les fenêtres enfants.
@@End@@

Pour utiliser les valeurs spécifiées ci-dessus, vous devez ajouter la ligne : #include <WindowsConstants.au3> dans votre script.

Remarque: Le handle renvoyé par cette fonction est un véritable handle de fenêtres, ce qui signifie qu'il peut être utilisé de la même manière que le résultat de WinGetHandle.

###Related###
<a href="GUISetParameters Management.htm">GUISetParameters...</a>, <a href="GUICtrlCreate Management.htm">GUICtrlCreate...</a>, <a href="GUIGetMsg.htm">GUIGetMsg</a>, <a href="GUISwitch.htm">GUISwitch</a>, <a href="GUIGetStyle.htm">GUIGetStyle</a>, <a href="GUIDelete.htm">GUIDelete</a>, <a href="WinGetHandle.htm">WinGetHandle</a>, <a href="GUICtrlSetDefBkColor.htm">GUICtrlSetDefBkColor</a>, <a href="GUICtrlSetDefColor.htm">GUICtrlSetDefColor</a>, <a href="GUIGetCursorInfo.htm">GUIGetCursorInfo</a>


###Example###
@@IncludeExample@@


Traducteur : TT22

Contributeurs (pour les modifications avant le Wiki) : Tlem, zarnergun