Jump to content

is there a better way for this ?


Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...