Function Reference


_WinAPI_GetMonitorInfo

Retrieves information about a display monitor

#include <WinAPISys.au3>
_WinAPI_GetMonitorInfo ( $hMonitor )

Parameters

$hMonitor A handle to the display monitor of interest.

Return Value

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".
Failure: Sets the @error flag to non-zero.

See Also

Search GetMonitorInfo in MSDN Library.

Example

#include <WinAPIGdi.au3>
#include <WinAPISys.au3>

Local $tPos = _WinAPI_GetMousePos()
Local $hMonitor = _WinAPI_MonitorFromPoint($tPos)

Local $aData = _WinAPI_GetMonitorInfo($hMonitor)
If IsArray($aData) Then
    ConsoleWrite('Handle:      ' & $hMonitor & @CRLF)
    ConsoleWrite('Rectangle:   ' & DllStructGetData($aData[0], 1) & ', ' & DllStructGetData($aData[0], 2) & ', ' & DllStructGetData($aData[0], 3) & ', ' & DllStructGetData($aData[0], 4) & @CRLF)
    ConsoleWrite('Work area:   ' & DllStructGetData($aData[1], 1) & ', ' & DllStructGetData($aData[1], 2) & ', ' & DllStructGetData($aData[1], 3) & ', ' & DllStructGetData($aData[1], 4) & @CRLF)
    ConsoleWrite('Primary:     ' & $aData[2] & @CRLF)
    ConsoleWrite('Device name: ' & $aData[3] & @CRLF)
EndIf