@jpm I got 2 scripts that could be interesting for the help file (at least the 1st script) :
1) _WinAPI_GetWindowInfo
The example found in AutoIt help file could show more functionalities of the interesting function GetWindowInfo (especially $tagWINDOWINFO structure isn't found in the help file), for example :
#include <WinAPISysWin.au3>
Example()
Func Example()
; Open Notepad
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
Local $hWnd = WinGetHandle("[CLASS:Notepad]")
If $hWnd = 0 Then Exit MsgBox(0, "NotePad", "Handle = 0")
; Move NotePad window to 10, 10 and resize it to 500, 400
WinMove($hWnd, "", 10, 10, 500, 400)
ConsoleWrite("Window Title : " & WinGetTitle($hWnd) & @crlf)
; Get infos concerning NotePad Window
Local $tWINDOWINFO = _WinAPI_GetWindowInfo($hWnd)
ConsoleWrite("Window coords : Left & Top & Right & Bottom : " & _
$tWINDOWINFO.rWindow(1) & " / " & $tWINDOWINFO.rWindow(2) & " / " & _
$tWINDOWINFO.rWindow(3) & " / " & $tWINDOWINFO.rWindow(4) & @crlf)
ConsoleWrite("Client coords : Left & Top & Right & Bottom : " & _
$tWINDOWINFO.rClient(1) & " / " & $tWINDOWINFO.rClient(2) & " / " & _
$tWINDOWINFO.rClient(3) & " / " & $tWINDOWINFO.rClient(4) & @crlf)
ConsoleWrite("Border : Width & Height : " & _
$tWINDOWINFO.cxWindowBorders & " / " & $tWINDOWINFO.cyWindowBorders & @crlf)
ConsoleWrite("Active ? " & ($tWINDOWINFO.WindowStatus = 1 ? "Yes" : "No") & @crlf)
ConsoleWrite("Style : " & "0x" & Hex($tWINDOWINFO.Style, 8) & @crlf)
ConsoleWrite("Extended Style : " & "0x" & Hex($tWINDOWINFO.ExStyle, 8) & @crlf)
ConsoleWrite("Class Atom : " & $tWINDOWINFO.atomWindowType & @crlf)
ConsoleWrite("Window creator version : " & "0x" & Hex($tWINDOWINFO.CreatorVersion, 4) & @crlf & @crlf)
Local $tWinRECT = _WinAPI_GetWindowRect($hWnd)
ConsoleWrite("Reminder : _WinAPI_GetWindowRect : Left & Top & Right & Bottom : " & _
$tWinRECT.left & " / " & $tWinRECT.top & " / " & _
$tWinRECT.right & " / " & $tWinRECT.bottom & @crlf)
Local $tCliRECT = _WinAPI_GetClientRect($hWnd)
ConsoleWrite("Reminder : _WinAPI_GetClientRect : Left & Top & Right & Bottom : " & _
$tCliRECT.left & " / " & $tCliRECT.top & " / " & _
$tCliRECT.right & " / " & $tCliRECT.bottom & @crlf)
MsgBox(0,"Message","End script when you wish")
; Close Notepad window
WinClose($hWnd)
EndFunc ;==>Example
2) _WinAPI_GetTitleBarInfo
If I'm not mistaken, this function doesn't exist in AutoIt. As I needed the GetTitleBarInfo function (which requires the TITLEBARINFO structure) then I scripted what follows :
#include <WinAPISysWin.au3>
Example()
Func Example()
Sleep(3000) ; give time for user to change the active window
Local $hWnd = WinGetHandle("[ACTIVE]")
Local $sTitle = WinGetTitle($hWnd)
Local $sClassName = _WinAPI_GetClassName($hWnd)
ConsoleWrite("Window Active Handle : " & $hWnd & @crlf)
ConsoleWrite("Window Title : " & $sTitle & @crlf)
ConsoleWrite("Class Name : " & $sClassName & @crlf)
Local $tTITLEBARINFO = _WinAPI_GetTitleBarInfo($hWnd)
ConsoleWrite("TitleBar Coords : Left & Top & Right & Bottom : " & _
$tTITLEBARINFO.TitleBar(1) & " / " & $tTITLEBARINFO.TitleBar(2) & " / " & _
$tTITLEBARINFO.TitleBar(3) & " / " & $tTITLEBARINFO.TitleBar(4) & @crlf)
For $i = 1 To 6
ConsoleWrite("Element " & $i & " : 0x" & Hex($tTITLEBARINFO.State(($i)), 8) & @crlf)
Next
EndFunc ;==>Example
;==================================
Func _WinAPI_GetTitleBarInfo($hWnd)
Local Const $CCHILDREN_TITLEBAR = 5
Local Const $tagTITLEBARINFO = 'dword Size;long TitleBar[4];dword State[' & ($CCHILDREN_TITLEBAR + 1 ) & ']'
Local $tTITLEBARINFO = DllStructCreate($tagTITLEBARINFO)
DllStructSetData($tTITLEBARINFO, 'Size', DllStructGetSize($tTITLEBARINFO))
Local $aCall = DllCall('user32.dll', 'bool', 'GetTitleBarInfo', 'hwnd', $hWnd, 'struct*', $tTITLEBARINFO)
If @error Or Not $aCall[0] Then Return SetError(@error + 10, @extended, 0)
Return $tTITLEBARINFO
EndFunc ;==>_WinAPI_GetTitleBarInfo
Let's hope both scripts are correct. Thanks for reading