Jump to content
Sign in to follow this  
ezzetabi

Enumerate all windows!

Recommended Posts

ezzetabi

(Damn it, wrong forum) Jon, can you move this to v3 Scripts and Scraps?

Check here!

http://www.autoitscript.com/forum/index.php?showtopic=5764

Larry made a perfectly working 'Find all windows handles' Func!

I found no topic about that great func in this section (actually the other one) so I posted it.

Thanks Larry!

Opt ('WinTitleMatchMode', 4)
$a = _GetWindowHandles()

$msg = ''
For $c = 1 To $a[0]
   $msg = $msg & WinGetTitle('handle=' & $a[$c]) & @LF
Next
MsgBox(0, '', $msg)

Exit
Func _GetWindowHandles()
   $GW_HWNDNEXT = 2
   $GW_CHILD = 5
   Dim $List[1]
   $List[0] = 0
   
   $x = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
   If @error Then Return $List
   $x = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $x[0], "int", $GW_CHILD)
   If @error Then Return $List
   
   While 1
      $x = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $x[0], "int", $GW_HWNDNEXT)
      If @error Then ExitLoop
      If String($x[0]) = "00000000" Then ExitLoop
      If BitAND(WinGetState($x[0]), 2) Then
         $ub = UBound($List)
         ReDim $List[$ub + 1]
         $List[$ub] = $x[0]
         $List[0] = $ub
      EndIf
   Wend
   Return $List
EndFunc  ;==>_GetWindowHandles
Edited by ezzetabi

Share this post


Link to post
Share on other sites
scriptkitty

Oh yea, thanks Larry. One UDF I keep finding uses for :)


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites
scriptkitty

All Larry, I tried for a while on that as soon as I started playing with the DDL function, but I didn't figure it out until I saw Larry's UDF.

I make my own variations, like finding all the hidden ones only, etc etc.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites
this-is-me

The unstable now has this functionality built in...


Who else would I be?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.