Page 1 of 1

Desktop resolution

Posted: Sat Nov 16, 2024 8:44 am
by jak64
Good morning,
I have programs using windows only (no OpenWindowedScreen or OpenScreen).
I wrote these programs on my computer with a resolution of 1366x768 pixels with an enlargement factor of 100%.

If I run it on a computer with a resolution of 1920x1080 pixels, with an enlargement factor of 150%, for example, the display is not correct.

I would like, at the start of my program, to set the resolution to 1366x768 pixels with an enlargement factor of 100% and at the end of my program, return the previous values.

I searched through the posts but couldn't find anything along these lines.

Is there a solution?

Thank you for your help

Re: Desktop resolution

Posted: Sat Nov 16, 2024 9:43 am
by DarkDragon
So you want to change the screen resolution including all other programs? The usual way would be to enable DPI Aware Executable in the compiler options and/or using DesktopScaledX/DesktopScaledY to scale the remaining things.

Image

Re: Desktop resolution

Posted: Sat Nov 16, 2024 9:59 am
by jak64
Hello DarkDragon,
Thank you for your answer, I tried that but you have to take into account the resolution and the enlargement factor and it's not simple.

I'm simply looking for a routine that would change the resolution and magnification factor at the start of the program and return the previous values ​​at the end of the program. There must be a routine that does this.

Re: Desktop resolution

Posted: Sat Nov 16, 2024 10:22 am
by DarkDragon
jak64 wrote: Sat Nov 16, 2024 9:59 am Hello DarkDragon,
Thank you for your answer, I tried that but you have to take into account the resolution and the enlargement factor and it's not simple.

I'm simply looking for a routine that would change the resolution and magnification factor at the start of the program and return the previous values ​​at the end of the program. There must be a routine that does this.
With the ChangeDisplaySettings_ API function you can change the screen's resolution on Windows:

http://www.purearea.net/pb/CodeArchiv/W ... eenMode.pb

Re: Desktop resolution

Posted: Sat Nov 16, 2024 10:33 am
by jak64
Thanks but the code does not work with PureBasic v6.10!

Re: Desktop resolution

Posted: Sat Nov 16, 2024 10:44 am
by spikey
jak64 wrote: Sat Nov 16, 2024 10:33 am Thanks but the code does not work with PureBasic v6.10!
Remove this line and its corresponding EndIf:

Code: Select all

If CreateGadgetList(WindowID(0))

Re: Desktop resolution

Posted: Sat Nov 16, 2024 10:50 am
by jak64
Thanks spikey
It works great!

Re: Desktop resolution

Posted: Sat Nov 16, 2024 2:15 pm
by Olli
I think the desktop resolution will do a very good scientific article. I imagine the title :

Correlation of the published alternation of two display scale values ​​under Licrosoft and the impoverishment of its clients, direct or non.