View Full Version : Weird Fullscreen/Release Bug

09-13-2000, 02:52 PM
The bug is that the code below does not make my program switch to fullscreen only when i'm compiling the program for release. When running in debug mode everything works fine. Anyone have any ideas about what could be causing this??
I'm running MsVC++ 6.0


Marcus Hays

DEVMODE dmScreenSettings ;
dmScreenSettings.dmPelsWidth = ScreenWidth;
dmScreenSettings.dmPelsHeight = ScreenHeight;
dmScreenSettings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;


09-13-2000, 05:36 PM
From my experience with this, I have always had problems with ChangeDisplaySettings(). The same code run on Win95 would produce different artifacts on Win98 etc. As far as your problem with debug vs. release, I don't use MSVC so I am not sure what it does differently. When I think of debug mode, it should be just changing the compile options to produce extra symbols for use with debugging. Though, it might be using different libraries in debug mode. I'd make sure that you have recent kernel32, user32 and gdi32 dlls. Other than that, it is hard for me to give any other advice.

Good Luck,

09-14-2000, 05:56 AM
I'm almost sure this is becuase you arent fully initializing the structure. I cant remember the full definition of DEVMODE, but Im almost positive it has more than those 3 fields.

In debug mode, the compiler initializes all memory to some default value like 0xcdcdcdcd or other similarly easy-to-recognize values. ChangeDisplaySettings probably recognizes that these values are out of range and ignores the fields that you didnt initialize.

In release mode, no memory is ever preinitialized, so whatever is there is there. In this case, one of the fields is probably being passed in with a value that is in a valid range but not what you want. Try setting all the fields or doing a memset to initialize the structure to all zeros before you set the fields. This should clear things up.

Ron Frazier

Nicolas Lelong
09-14-2000, 06:02 AM
Yep actually DEVMODE has a lot of fields. I saw you do not initialize the dmSize files of DEVMODE, I think you should try this coz I sometimes had troubles when not initializing this field :

dmScreenSettings.dmSize = sizeof(DEVMODE);

Hope this helps.

09-14-2000, 09:04 AM
dmScreenSettings.dmSize = sizeof(DEVMODE);

Thank you all so much.

Marcus Hays