Desktop resolution

Just starting out? Need help? Post your questions and find answers here.
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Desktop resolution

Post 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
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Desktop resolution

Post 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
bye,
Daniel
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Desktop resolution

Post 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.
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Desktop resolution

Post 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
bye,
Daniel
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Desktop resolution

Post by jak64 »

Thanks but the code does not work with PureBasic v6.10!
User avatar
spikey
Enthusiast
Enthusiast
Posts: 778
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Desktop resolution

Post 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))
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Desktop resolution

Post by jak64 »

Thanks spikey
It works great!
Olli
Addict
Addict
Posts: 1266
Joined: Wed May 27, 2020 12:26 pm

Re: Desktop resolution

Post 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.
Post Reply