Closed chrisl8 closed 7 months ago
When you say later you mean what exactly?
There's a 5 second delay to accept the settings. If you don't accept with a key it reverts. This is to avoid setting a mode that doesn't work and locks you out.
If that's not what you mean I'm not sure. Once you set, you should see the setting reflected in your Windows Display settings which means it's set exactly as if you set it manually.
If it resets there's something else going on that's unrelated to the SetResolution operation. Like possibly some video mode that isn't always active - make sure you pick the right resolution/refresh for your monitor.
I am using the -noprompt
option so that it sets the resolution without asking. I'll try doing it without that to see if it helps.
Ok, I'll keep digging into it myself. Thanks for any insights you might have.
I found that the quickest way to reproduce it is to:
#1
If I set it back to the "normal" resolution via the Display settings in Windows, it keeps that resolution when being unplugged and plugged back in.
I will update if I sort out the cause.
I can confirm only that if I use this tool to change resolution and then unplug the monitor and plug it back in, or restart the computer, the resolution reverts to the previous setting.
If I use the Windows display settings to change the resolution, it sticks through reboots and monitor disconnection.
This appears to be a Windows issue though, not an issue with this tool.
If I am able to discover any clues to what causes this or what may look different on the system when using this tool vs. the Windows display setting I will update this.
For now though, this seems to be a Windows issue and not an issue with this tool, so I will close this.
Thank you for your excellent code and for any ideas you may have.
Thanks for following up.
Unfortunately I have no idea what the problem could be. This tool uses Windows APIs and it's working for and many others. Not saying that it's not happening but not sure what could be different. The only thing I can think of is that you're perhaps using a resolution combination that is not recognized on startup. Often there are a number of similar configurations (use the List command) and see if one of the other combinations works better.
I use this tool daily to switch between 3 different resolutions on my 4k monitor and it sticks across reboots.
If I use SetResolution to set a display resolution, and later Windows turns off the display, when it turns on again, it goes back to the previous resolution.
Only when I set the resolution via the Windows Display settings will it persist.