gmartinezsan Posted December 1, 2014 Posted December 1, 2014 Hi All, I'm trying to get all the controls that exists in an object form. Is there any way to iterate through them? Thanks in advance for any help.
Moderators SmOke_N Posted December 1, 2014 Moderators Posted December 1, 2014 What type of object form? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
jguinch Posted December 1, 2014 Posted December 1, 2014 gmartinezsan : you want to list all controls in a Windows ? Have a look here : '?do=embed' frameborder='0' data-embedContent>> Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
wolf9228 Posted December 2, 2014 Posted December 2, 2014 (edited) expandcollapse popup#include <WinAPI.au3> #include <Array.au3> Global $vChildWindwos = 0 HotKeySet("{F1}", "GetAllCtrls") HotKeySet("{ESC}", "Terminate") While 1 WEnd Func GetAllCtrls() $HWND = WinGetHandle(("[ACTIVE]")) $vChildWindwos = GetChildWindows($HWND) if IsArray($vChildWindwos) Then ReDim $vChildWindwos[UBound($vChildWindwos)][14] For $i = 0 To (UBound($vChildWindwos) - 1) $Handle = ControlGetHandle ($HWND,"",$vChildWindwos[$i][2]) $Pos = ControlGetPos ($HWND,"",$vChildWindwos[$i][2]) $vChildWindwos[$i][7] = $Handle $vChildWindwos[$i][8] = $vChildWindwos[$i][1] $vChildWindwos[$i][9] = $vChildWindwos[$i][2] $vChildWindwos[$i][10] = $Pos[0] $vChildWindwos[$i][11] = $Pos[1] $vChildWindwos[$i][12] = $Pos[2] $vChildWindwos[$i][13] = $Pos[3] Next _ArrayDisplay($vChildWindwos, "") EndIf EndFunc Func Terminate() Exit EndFunc Func GetChildWindows($HWND) $vChildWindwos = 0 $RegChildProc = DLLCallbackRegister("EnumChildProc","BOOL","HWND;LPARAM") $ChildProcPtr = DllCallbackGetPtr($RegChildProc) DllCall("user32.dll","BOOL","EnumChildWindows","HWND",$HWND,"PTR",$ChildProcPtr,"LPARAM",$HWND) DllCallbackFree($RegChildProc) Return $vChildWindwos EndFunc Func EnumChildProc($HWND,$lParam) Local $EndTest = False For $i = 0 To UBound($vChildWindwos) - 1 if $HWND = $vChildWindwos[$i][0] Then $EndTest = True Next if $EndTest = False Then if Not IsArray($vChildWindwos) Then Dim $vChildWindwos[1][7] Else ReDim $vChildWindwos[UBound($vChildWindwos) + 1][7] EndIf $Rect = _WinAPI_GetWindowRect($HWND) $Left = DllStructGetData($Rect,1) $Top = DllStructGetData($Rect,2) $Right = DllStructGetData($Rect,3) $Bottom = DllStructGetData($Rect,4) $W = $Right - $Left $H = $Bottom - $Top _WinAPI_ScreenToClient($lParam,$Rect) $L = DllStructGetData($Rect,1) $T = DllStructGetData($Rect,2) $ClassName = _WinAPI_GetClassName($HWND) $vChildWindwos[UBound($vChildWindwos) - 1][0] = $HWND $vChildWindwos[UBound($vChildWindwos) - 1][1] = $ClassName $INSTANCE = 0 For $j = 0 To (UBound($vChildWindwos) - 1) if $ClassName == $vChildWindwos[$j][1] Then $INSTANCE += 1 Next $vChildWindwos[UBound($vChildWindwos) - 1][2] = "[CLASS:" & $ClassName & "; INSTANCE:" & $INSTANCE & "]" $vChildWindwos[UBound($vChildWindwos) - 1][3] = $L $vChildWindwos[UBound($vChildWindwos) - 1][4] = $T $vChildWindwos[UBound($vChildWindwos) - 1][5] = $W $vChildWindwos[UBound($vChildWindwos) - 1][6] = $H Return True Else Return False EndIf EndFunc Edited December 3, 2014 by wolf9228 صرح السماء كان هنا
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now