Jump to content

Get Screen Width and Height But Not the same as OS - (Moved)


vip88
 Share

Recommended Posts

#include <WinAPISys.au3>
MsgBox(0x44,"debug", @DesktopWidth & "x" & @DesktopHeight)
MsgBox(0x44,"debug", _WinAPI_GetSystemMetrics(78) & "x" & _WinAPI_GetSystemMetrics(79))

The above codes return 1024x640, but OS report 1280x800.

 

螢幕擷取畫面 (1).png

Link to comment
Share on other sites

Link to comment
Share on other sites

12 hours ago, LarsJ said:

Why use 78 and 79 for the virtual screen

Likely in case of multiple monitors I'd guess.

#include <WinAPISys.au3>
ConsoleWrite(@DesktopWidth & "x" & @DesktopHeight & @CRLF) ; 2560x1080 @ 100% ; 2048x864 @ 125%
ConsoleWrite( _WinAPI_GetSystemMetrics(0) & "x" & _WinAPI_GetSystemMetrics(1) & @CRLF) ; 2560x1080 ; 2048x864 @ 125%
ConsoleWrite( _WinAPI_GetSystemMetrics(78) & "x" & _WinAPI_GetSystemMetrics(79) & @CRLF) ; 3760x1920 ; 3760x1920 @ 125% on monitor 1

... I have 2 monitors.

@vip88, I guess the same answer as in https://www.autoitscript.com/forum/topic/205087-pixelgetcolor-return-value-is-not-correct-when-xy-reported-by-au3info-moved/ , so use _WinAPI_EnumDisplayMonitors().

Edit: I see, that "AutoIt v3 Window Info" nor CV, compensates for monitor scaling. I'll look into that for CV.

Edit2: You can find the answer in _WinAPI_SetProcessDpiAwareness().

Edited by argumentum
added code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...