Enable resolutions not exposed by display programmatically on NVIDIA GPUs -
i'm working on solution there need set custom resolution particular connected displays on set of systems. have works fine, long "enable resolutions not exposed display" option has been checked manually through nvidia control panel (found under display -> change resolution > customize... > enable resolutions not exposed display).
is there way enable option programmatically, preferably through nvidia's core sdk - nvapi.
setting custom resolutions can enabled through changedisplaysettingsex function, exposed windows api, passing in cds_enable_unsafe_modes
fourth parameter dwflags
. (to disable, use cds_disable_unsafe_modes
.)
code extract exemplifying usage:
dword deviceindex = 0; display_device displaydevice = { 0 }; displaydevice.cb = sizeof(display_device); while (enumdisplaydevices(null, deviceindex, &displaydevice, 0)) { deviceindex++; devmode devicemode = { 0 }; devicemode.dmsize = sizeof(devmode); if (!enumdisplaysettings(displaydevice.devicename, enum_current_settings, &devicemode)) continue; auto result = changedisplaysettingsex(displaydevice.devicename, &devicemode, null, cds_enable_unsafe_modes, null); if (result != disp_change_successful) { // handle failure here... } }
note enable unsafe graphics modes display devices.
Comments
Post a Comment