Anthony Miller
Anthony Miller

Reputation: 15921

Get the resolution of a 2nd or 3rd monitor

How would I go about fetching the resolution of a 2nd or 3rd monitor via an AutoIT script?

Is there a specific function available for this?

Upvotes: 1

Views: 121

Answers (1)

Anthony Miller
Anthony Miller

Reputation: 15921

Discovered a 3rd party library. It can return the resolutions of each monitor relative to the default display.

I just got an idea how to order them properly as well. I'll have to add a small section to the library where it assigns the smallest x value (includes negative integers) to be the first monitor, the next smallest the 2nd monitor, so on and so forth.

An example to enumerate all physical monitors and obtain their x resolution:

Dim $x = 0, $_enum, $_xRes, $_xResPre
Do
    $_enum = _WinAPI_EnumDisplayDevices("", $x)
    If $_enum[3] = 35 OR $_enum[3] = 33 Then
        $x+=1
        $_xResPre = _MonitorAndDesktopInfo()
        $_xRes = $_xResPre[$x][1]
        msgbox(0, "", $_xRes)
    Else
        $x+=1
    EndIf
Until NOT $_enum[3]

Upvotes: 1

Related Questions