# Function Reference

# _WinAPI_EnumDesktopWindows

Enumerates all top-level windows associated with the specified desktop

#include <WinAPISys.au3>
_WinAPI_EnumDesktopWindows ( $hDesktop [, $bVisible = True] )

## Parameters

$hDesktop | Handle to the desktop whose top-level windows are to be enumerated. This handle must have the $DESKTOP_READOBJECTS access right.
$bVisible | [optional] Specifies whether enumerates the invisible window, valid values: True - Enumerate only visible windows (Default). False - Enumerate all windows.

## Return Value

Success: | The 2D array of the handles to the window and its class associated with the specified desktop. [0][0] - Number of rows in array (n) [0][1] - Unused [n][0] - Window handle [n][1] - Window class name
Failure: | Sets the @error flag to non-zero.

## See Also

Search EnumDesktopWindows in MSDN Library.

## Example

    #include <Array.au3>
    #include <WinAPIProc.au3>
    #include <WinAPISys.au3>

    Local $aData = _WinAPI_EnumDesktopWindows(_WinAPI_GetThreadDesktop(_WinAPI_GetCurrentThreadId()))

    _ArrayDisplay($aData, '_WinAPI_EnumDesktopWindows')