Function Reference


_WinAPI_EnumWindowsTop

Enumerates all top level windows

#include <WinAPISysWin.au3>
_WinAPI_EnumWindowsTop ( )

Return Value

Returns an array with the following format:
[0][0] - Number of rows in array (n)
[1][0] - Window handle
[1][1] - Window class name
[n][0] - Window handle
[n][1] - Window class name

Related

_WinAPI_EnumWindows, _WinAPI_EnumWindowsPopup

Example

#include <MsgBoxConstants.au3>
#include <WinAPISysWin.au3>

Example()

Func Example()
    Local $aWindows, $i, $sText
    $aWindows = _WinAPI_EnumWindowsTop()
    For $i = 1 To $aWindows[0][0]
        $sText = "Window Handle: " & $aWindows[$i][0] & @CRLF
        $sText &= "Window Class: " & $aWindows[$i][1] & @CRLF
        $sText &= "Window Title: " & WinGetTitle($aWindows[$i][0]) & @CRLF
        $sText &= "Window Text: " & WinGetText($aWindows[$i][0]) & @CRLF
        $sText &= "Window Process: " & WinGetProcess($aWindows[$i][0])
        MsgBox($MB_SYSTEMMODAL, "Item " & $i & " of " & $aWindows[0][0], $sText)
    Next
EndFunc   ;==>Example