ChangeDisplaySettingsEx Function

Hi Everybody,

As a change of pace I have my code working for valid screen resolutions on the device attached to the system. My problem is that I am shooting for a resolution that is "not supported". When I run my code with a target resolution of "800 x 600" ChangeDisplaySettingsEx returns DISP_CHANGE_BADMODE which of course means that the resolution is not supported I can verify this by changing the width and height arguments in my code to a valid resolution such as "1280 x 1024". But the interesting thing is that I can manually change the resolution through the control panel to the target "800 x 600" and running my code after this, in effect changing the resolution to the current size, returns DISP_CHANGE_SUCCESSFUL. Also changing the resolution manually then resetting it to a valid resolution with my code works and returns DISP_CHANGE_SUCCESSFUL.

I have a feeling that this is because I am missing a command specific to the display drivers that the system is using, but if that is the case I am stuck as I don't know where to look next.

I will post my code upon request but I am only using native Windows XP headers and libs.
So evidently it's not enough to tell the Windows API that I want the resolutions set and EXACTLY what I want it set for but I have to initialize two components of a data strcuture that is only half filled in when I call two seperate functions to populate it :p.

SUMMARY: I wasn't setting the dmPelsWidth or dmPelsHeight flags in the dmFields member of the DEVMODE stucture. There aren't any errors when you forget to do this. The code is verified to be working now.
Last edited on
Topic archived. No new replies allowed.