Can I get the scaling factor per display?
Posted: Mon Feb 05, 2018 6:04 am
It would be really helpful if I could find out the display scaling factor for each connected display. Calculating this for the primary display is easy enough, as shown in this code:
which correctly returns this:
However, my second monitor has a display size of 3840x2160 with a display scaling set to 175%. I can get the display size using DesktopWidth(1) and DesktopHeight(1), but I can't find a way to determine the 'horizontal resolution' of a display other than the primary display. Any suggestions?
Code: Select all
ExamineDesktops()
myDesktopWidth = DesktopWidth(0)
myDesktopHeight = DesktopHeight(0)
Debug "myDesktopWidth=" + myDesktopWidth + ", myDesktopHeight=" + myDesktopHeight
myHorzRes = GetDeviceCaps_(GetDC_(GetDesktopWindow_()), #HORZRES)
myVertRes = GetDeviceCaps_(GetDC_(GetDesktopWindow_()), #VERTRES)
Debug "myHorzRes=" + myHorzRes + ", myVertRes=" + myVertRes
myDisplayScaling = Round(myDesktopWidth * 100 / myHorzRes, #PB_Round_Nearest)
Debug "myDisplayScaling=" + myDisplayScaling + "%"
Code: Select all
[15:01:43] myDesktopWidth=1366, myDesktopHeight=768
[15:01:43] myHorzRes=1093, myVertRes=614
[15:01:43] myDisplayScaling=125%