Sign in to follow this  
Followers 0
AutoIT Geek

is there a better way for this ?

1 post in this topic

#1 ·  Posted (edited)

any quicker, shorter, less messy, whatever

any improvments are welcome :(:P:lmao:

this code runs on v3.1.1.91

#include <array.au3>


Global $Controls[ 1 ], $NULL = '0x00000000'


Func EnumControls( $FirstChild )
    
    Local $Child[ 3 ], $Temp[ 3 ]
    
    $Child[ 0 ] = $FirstChild


    Do
        
        _ArrayAdd( $Controls, $Child[ 0 ] )
        
        $Temp = DllCall( 'USER32.DLL', 'hwnd', 'GetWindow', 'hwnd', $Child[ 0 ], 'int', 5 ); GW_CHILD
            
        If $Temp[ 0 ] <> $NULL Then
                
            EnumControls( $Temp[ 0 ] )
                
            $Child = DllCall( 'USER32.DLL', 'hwnd', 'GetWindow', 'hwnd', $Child[ 0 ], 'int', 2 ); GW_HWNDNEXT
        
        Else
            
            $Child = DllCall( 'USER32.DLL', 'hwnd', 'GetWindow', 'hwnd', $Child[ 0 ], 'int', 2 ); GW_HWNDNEXT
        
        EndIf
            
    Until $Child[ 0 ] == $NULL

EndFunc


Run( $WinTitle )

$Parent = DllCall( 'USER32.DLL', 'hwnd', 'FindWindow', 'int', 0, 'str', $WinTitle ); <-- 

$Child = DllCall( 'USER32.DLL', 'hwnd', 'GetWindow', 'hwnd', $Parent[ 0 ], 'int', 5 ); GW_CHIILD

If $Child[ 0 ] <> $NULL Then EnumControls( $Child[ 0 ] )

_ArrayDisplay( $Controls, '   Handle   ' )
Edited by AutoIT Geek

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0