Active Forums => QB64 Discussion => Topic started by: hanness on March 22, 2021, 05:16:57 pm
Title: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: hanness on March 22, 2021, 05:16:57 pm
My laptop has a display resolution of 3840 x 2160, but when I run the code below it returns a display width of 1920 and a display height of 1080:
Option _Explicit Dim As Integer x, y ' image& = _ScreenImage x = _DesktopWidth y = _DesktopHeight Print x; y
Tested on Win 10, 20H2 with QB64 1.5
Title: Re: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: SMcNeill on March 22, 2021, 05:28:05 pm
It’s because you have windows scaling at 200%.
Set scale to 100% and you’ll get the full resolution.
Title: Re: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: SpriggsySpriggs on March 22, 2021, 08:52:35 pm
@hanness This is because QB64 programs are not DPI aware. I made a pull request on GitHub to fix a different issue that still is tied to yours that allows QB64 programs to be DPI aware. This should allow you to have full 3840 x 2160 even when at 200% resolution.
Title: Re: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: SpriggsySpriggs on March 22, 2021, 10:35:09 pm
Try running the below code with your scaling at 200% and see if you get the right results:
Title: Re: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: hanness on March 23, 2021, 01:00:07 am
Thanks much. That makes sense, and the code provided did indeed work.
As always, the help was very appreciated.
Title: Re: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: SpriggsySpriggs on March 23, 2021, 09:20:06 am
@hanness Awesome! Glad it worked for you. Your problem and LM's are both good examples to show that DPI awareness is needed in QB64.
Title: Re: What are the limits for _DesktopWidth and _DesktopHeight?
Post by: SpriggsySpriggs on March 24, 2021, 12:46:12 pm
@hanness The latest dev build has the bug fix and automatically makes the program DPI aware. Download at your convenience and let us know how it goes for you.