Retrieves the dimensions of the bounding rectangle of the specified window
#include <WinAPISysWin.au3>
_WinAPI_GetWindowRect ( $hWnd )
$hWnd | Handle of the window |
Success: | $tagRECT structure that receives the screen coordinates |
Failure: | Sets the @error flag to non-zero, call _WinAPI_GetLastError() to get extended error information |
Search GetWindowRect in MSDN Library.
#include <WinAPIGdi.au3>
#include <WinAPISysWin.au3>
_Example()
Func _Example()
Local $hWindow = WinGetHandle("[REGEXPTITLE:(?i)(.*" & @ScriptName & ".*SciTE.*?)]")
Local $tagRECT = _WinAPI_GetWindowRect($hWindow)
Local $hMonitor = _WinAPI_MonitorFromRect($tagRECT, $MONITOR_DEFAULTTONEAREST)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hMonitor = ' & $hMonitor & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console
Local $aData = _WinAPI_GetMonitorInfo($hMonitor)
If Not @error Then
ConsoleWrite('Handle: ' & $hMonitor & @CRLF)
ConsoleWrite('Rectangle: ' & DllStructGetData($aData[0], 1) & ', ' & DllStructGetData($aData[0], 2) & ', ' & DllStructGetData($aData[0], 3) & ', ' & DllStructGetData($aData[0], 4) & @CRLF)
ConsoleWrite('Work area: ' & DllStructGetData($aData[1], 1) & ', ' & DllStructGetData($aData[1], 2) & ', ' & DllStructGetData($aData[1], 3) & ', ' & DllStructGetData($aData[1], 4) & @CRLF)
ConsoleWrite('Primary: ' & $aData[2] & @CRLF)
ConsoleWrite('Device name: ' & $aData[3] & @CRLF)
EndIf
EndFunc ;==>_Example