Retrieves information about a display monitor.
#Include <WinAPIEx.au3>
_WinAPI_GetMonitorInfo ( $hMonitor )
$hMonitor | A handle to the display monitor of interest. |
Success | The array containing the following information: |
[0] | $tagRECT structure that specifies the display monitor rectangle, in virtual-screen coordinates. |
[1] | $tagRECT structure that specifies the work area rectangle of the display monitor that can be used by applications, in virtual-screen coordinates. |
[2] | 1 (True) for the primary display monitor, or 0 (False) otherwise. |
[3] | The device name of the monitor being used, e.g. "\\.\DISPLAY1". |
失败: | 返回 0 并设置 @error 标志为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $hMonitor, $Data
$hMonitor = _WinAPI_MonitorFromPoint(_WinAPI_GetMousePos())
If @error Then
Exit
EndIf
$Data = _WinAPI_GetMonitorInfo($hMonitor)
If IsArray($Data) Then
ConsoleWrite('Handle: ' & $hMonitor & @CR)
ConsoleWrite('Rectangle: ' & DllStructGetData($Data[0], 1) & ', ' & DllStructGetData($Data[0], 2) & ', ' & DllStructGetData($Data[0], 3) & ', ' & DllStructGetData($Data[0], 4) & @CR)
ConsoleWrite('Work area: ' & DllStructGetData($Data[1], 1) & ', ' & DllStructGetData($Data[1], 2) & ', ' & DllStructGetData($Data[1], 3) & ', ' & DllStructGetData($Data[1], 4) & @CR)
ConsoleWrite('Primary: ' & $Data[2] & @CR)
ConsoleWrite('Device name: ' & $Data[3] & @CR)
EndIf