Setting desktop resolution problem
Posted: Wed Jan 06, 2021 4:16 am
I use this simple code to change my desktop resolution on Win 10:
And it works great. But then I used it to change back to 1920 x 1080 (instead of 800 x 600), and it worked great again.
But when my PC rebooted, it was back at 800 x 600, as if 1920 x 1080 didn't get "remembered". Am I supposed to be doing something else?
[Edit] I just saw this -> https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-changedisplaysettingsexa and I'm guessing that instead of passing 0 for the last param of ChangeDisplaySettings_(), that I should be specifying #CDS_UPDATEREGISTRY for it? Would that be right?
Code: Select all
res.DEVMODE\dmSize=SizeOf(DEVMODE)
res\dmPelsWidth=800
res\dmPelsHeight=600
res\dmFields=#DM_PELSWIDTH|#DM_PELSHEIGHT
ChangeDisplaySettings_(@res.DEVMODE,0)
But when my PC rebooted, it was back at 800 x 600, as if 1920 x 1080 didn't get "remembered". Am I supposed to be doing something else?
[Edit] I just saw this -> https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-changedisplaysettingsexa and I'm guessing that instead of passing 0 for the last param of ChangeDisplaySettings_(), that I should be specifying #CDS_UPDATEREGISTRY for it? Would that be right?