I'm working on a solution where there is a need to set a custom resolution for a particular connected displays on a set of systems. What I have now works fine, but only as long as the "Enable resolutions not exposed by the display" option has been checked manually through the NVIDIA Control Panel (found under Display -> Change resolution > Customize... > Enable resolutions not exposed by the display).
Is there a way to enable this option programmatically, preferably through NVIDIA's core SDK - NVAPI.
Setting custom resolutions can be enabled through the ChangeDisplaySettingsEx function, exposed by the Windows API, by passing in
CDS_ENABLE_UNSAFE_MODES
as the fourth parameterdwflags
. (To disable, useCDS_DISABLE_UNSAFE_MODES
.)Code extract exemplifying usage:
Note that this will enable unsafe graphics modes for all display devices.