Search the Community
Showing results for tags 'wrong screen reosolution'.
-
I recently upgraded my laptop to one with Windows 10 and higher screen resolution. In the process I found that some of my scripts did not work right when using Autoit's @DesktopWidth and @DesktopHeight macros. Insteat of 1920 x 1080 resolution Autoit detects 1536 x 864. Thus, GUIs designed to appear near the right edge of the screen displayed closer to the horizontal middle of the screen. I assume others may have the same problem. A search on this forum and Microsoft Script Center helped me to write the following script that gets the true screen width and height from WMI. MsgBox(0, '', _GetMonitorInfo()) Func _GetMonitorInfo() Local $oWMI, $Listing, $sWidth = 0, $sHeight = 0 $oWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") If IsObj($oWMI) Then $Listing = $oWMI.ExecQuery("SELECT * FROM Win32_DesktopMonitor") If IsObj($Listing) Then For $oItem In $Listing $sHeight = $oItem.ScreenHeight $sWidth = $oItem.ScreenWidth Next EndIf EndIf Return "Width: " & $sWidth & @CRLF & "Height: " & $sHeight EndFunc ;_GetMonitorInfo Hopefully it will benefit others. I for sure am very happy with all the samples I been able to find here in the past.
- 6 replies
-
- windows
- screen resolution
-
(and 3 more)
Tagged with: