Calcule la position appropri�e de la fen�tre d�roulante et retourne une structure rectangle
#include <GuiMenu.au3>
_GUICtrlMenu_CalculatePopupWindowPosition ( $iX, $iY, $iWidth, $iHeight [, $iFlags = 0 [, $tExclude = 0]] )
$iX | La coordonn�e x, en unit�s logiques, du point d'ancrage sp�cifi�. |
$iY | La coordonn�e y, en unit�s logiques, du point d'ancrage sp�cifi�. |
$iWidth | La largeur, en unit�s logiques, de la fen�tre sp�cifi�e. |
$iHeight | La hauteur, en unit�s logiques, de la fen�tre sp�cifi�e. |
$iFlags | [optionnel] Les flags qui sp�cifient comment la fonction positionne la fen�tre pop-up horizontalement et verticalement. $TPM_CENTERALIGN $TPM_LEFTALIGN (par d�faut) $TPM_RIGHTALIGN $TPM_BOTTOMALIGN $TPM_TOPALIGN (par d�faut) $TPM_VCENTERALIGN $TPM_HORIZONTAL (par d�faut) $TPM_VERTICAL $TPM_WORKAREA |
$tExclude | [optionnel] Structure $tagRECT qui sp�cifie le rectangle � exclure. |
Succ�s: | Retourne une structure $tagRECT qui contient la position de la fen�tre d�roulante. |
�chec: | D�finit @error <> 0 et appelle la fonction _WinAPI_GetLastError() pour obtenir des informations sur l'erreur. |
Cette fonction n�cessite Windows 7 ou une version ult�rieure.
Consultez CalculatePopupWindowPosition dans la librairie MSDN.
#include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <MsgBoxConstants.au3> #include <WinAPIConv.au3> #include <WinAPISysWin.au3> Local $hForm = GUICreate('Test '& StringReplace(@ScriptName, '.au3', '()'), 400, 400) Local $idButton = GUICtrlCreateButton('New Window', 145, 366, 110, 23) GUISetState(@SW_SHOW) Global $iMsg Do $iMsg = GUIGetMsg() If $iMsg = $idButton Then _PopupDlg($hForm) EndIf Until $iMsg = $GUI_EVENT_CLOSE Func _PopupDlg($hParent) GUISetState(@SW_DISABLE, $hParent) Local $tPOINT = DllStructCreate($tagPOINT) For $i = 1 To 2 DllStructSetData($tPOINT, $i, 0) Next _WinAPI_ClientToScreen($hParent, $tPOINT) Local $hDlg = GUICreate('New Window', 400, 400) Local $idButton = GUICtrlCreateButton('Close', 165, 366, 70, 23) Local $tRECT = _GUICtrlMenu_CalculatePopupWindowPosition(DllStructGetData($tPOINT, 1), DllStructGetData($tPOINT, 2), _WinAPI_GetWindowWidth($hDlg), _WinAPI_GetWindowHeight($hDlg)) If @error Then MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows 7 or later.') Exit EndIf WinMove($hDlg, '', DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2)) GUISetState(@SW_SHOW, $hDlg) Do $iMsg = GUIGetMsg() Until $iMsg = $GUI_EVENT_CLOSE Or $iMsg = $idButton GUISetState(@SW_ENABLE, $hParent) GUIDelete($hDlg) EndFunc ;==>_PopupDlg