I'm working on a pretty large program that makes calls to ChangeDisplaySettingsEx in order to change the layout/resolution around of displays.
I've been running into issues where these calls sometimes work and sometimes they don't, and I can't determine what's causing the failures.
Whenever it fails, I get a return code of -1 which corresponds to DISP_CHANGE_FAILED which clearly is not very descriptive.
I'm wondering if there's any better way to debug the result of the call so I can tell what's causing it to fail?
You may try to query the actual displays capabilities beforehand, as recommended in the reference documentation:
After doing so you can compare the returned
DEVMODE
with what you've tried to pass as settings.