# Function Reference

# _WinAPI_EnumDisplayMonitors

Enumerates display monitors (including invisible pseudo-monitors associated with the mirroring drivers)

#include <WinAPIGdi.au3>
_WinAPI_EnumDisplayMonitors ( [$hDC = 0 [, $tRECT = 0]] )

## Parameters

$hDC | [optional] Handle to a display device context that defines the visible region of interest. If it's 0 (Default), the visible region of interest is the virtual screen that encompasses all the displays on the desktop.
$tRECT | [optional] $tagRECT structure that specifies a clipping rectangle. This parameter can be 0 (Default) if you don't want to clip the specified region.

## Return Value

Success: | The 2D array containing the following information: [0][0] - Number of rows in array (n) [0][1] - Unused [n][0] - A handle to the display monitor. [n][1] - $tagRECT structure defining a display monitor rectangle or the clipping area.
Failure: | Sets the @error flag to non-zero.

## See Also

Search EnumDisplayMonitors in MSDN Library.

## Example

    #include <Array.au3>
    #include <WinAPIGdi.au3>

    Local $aPos, $aData = _WinAPI_EnumDisplayMonitors()

    If IsArray($aData) Then
        ReDim $aData[$aData[0][0] + 1][5]
        For $i = 1 To $aData[0][0]
            $aPos = _WinAPI_GetPosFromRect($aData[$i][1])
            For $j = 0 To 3
                $aData[$i][$j + 1] = $aPos[$j]
            Next
        Next
    EndIf

    _ArrayDisplay($aData, '_WinAPI_EnumDisplayMonitors')