Function Reference


_WinAPI_EnumWindows

Enumerates all windows

#include <WinAPISysWin.au3>
_WinAPI_EnumWindows ( [$bVisible = True [, $hWnd = Default]] )

Parameters

$bVisible [optional] Window selection flag:
True - Returns only visible windows
False - Returns all windows
$hWnd [optional] Handle of the starting windows (default Desktop windows)

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_EnumWindowsPopup, _WinAPI_EnumWindowsTop

Example

#include <Array.au3>
#include <WinAPISysWin.au3>

Example()

Func Example()
        Local $aWindows = _WinAPI_EnumWindows()
        Local $aResult[$aWindows[0][0]][5]
        For $i = 1 To $aWindows[0][0]
                $aResult[$i - 1][0] = $aWindows[$i][0]
                $aResult[$i - 1][1] = $aWindows[$i][1]
                $aResult[$i - 1][2] = WinGetTitle($aWindows[$i][0])
                $aResult[$i - 1][3] = WinGetText($aWindows[$i][0])
                $aResult[$i - 1][4] = WinGetProcess($aWindows[$i][0])
        Next
        _ArrayDisplay($aResult, "_WinAPI_EnumWindows", Default, Default, Default, "#|Handle|Class|Title|Text|Process")
EndFunc   ;==>Example