#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <WindowsConstants.au3>
#include <WinAPIGdi.au3>
Global $hGui = GUICreate('Au3Gui', 500, 500, -1, -1, $WS_OVERLAPPEDWINDOW)
WinSetTrans($hGui, '', 100)
Global $Label1 = GUICtrlCreateLabel("", 200, 200, 300, 300)
GUICtrlSetFont(-1, 200, 900, 0, "MS Sans Serif")
GUISetState(@SW_SHOW, $hGui)
Global $aMon = _GetMonitorsArray()
If IsArray($aMon) Then
For $i = 1 To $aMon[0][0]
WinMove($hGui, "", $aMon[$i][1], $aMon[$i][2])
GUISetState(@SW_MAXIMIZE, $hGui)
GUICtrlSetData($Label1, $i)
ConsoleWrite(" index: " & $i & @CRLF)
ConsoleWrite("- [0]=handle=" & $aMon[$i][0] & @CRLF)
ConsoleWrite("- [1]=left=" & $aMon[$i][1] & @CRLF)
ConsoleWrite("- [2]=top=" & $aMon[$i][2] & @CRLF)
ConsoleWrite("- [3]=width=" & $aMon[$i][3] & @CRLF)
ConsoleWrite("- [4]=height=" & $aMon[$i][4] & @CRLF)
ConsoleWrite("" & @CRLF)
_GetMonitorInfo($hGui)
Sleep(2000)
Next
EndIf
;----------------------------------------------------------------------------------------
Func _GetMonitorInfo($hWindow)
Local $hMonitor = _WinAPI_MonitorFromWindow($hWindow, $MONITOR_DEFAULTTONULL)
Local $aData = _WinAPI_GetMonitorInfo($hMonitor)
ConsoleWrite('MonitorInfo **********************' & @CRLF)
If Not @error 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)
ConsoleWrite("**********************************" & @CRLF & @CRLF)
EndIf
EndFunc ;==>_GetMonitorInfo
;----------------------------------------------------------------------------------------
Func _GetMonitorsArray()
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
Return $aData
EndFunc ;==>_GetMonitorsArray
;----------------------------------------------------------------------------------------