函数参考


_WinAPI_EnumDisplayMonitors

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

#Include <WinAPIEx.au3>
_WinAPI_EnumDisplayMonitors ( [$hDC [, $tRECT]] )

参数

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

返回值

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.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

None

相关

详情参考

在MSDN中搜索


示例/演示


#Include <Array.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $Pos, $Data = _WinAPI_EnumDisplayMonitors()

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

_ArrayDisplay($Data, '_WinAPI_EnumDisplayMonitors')