Skip to main content
GameDev.net gamedev.net
🔒 Locked

Display mode changes

Started by Topgoro Sep 7, 2000 at 12:07 PM 4 replies 800+ views
Original Post
Topgoro
Topgoro
Hi all. When I "SetDisplayMode" using DirectDraw to a mode matching the current desktop mode, my program works flawlessly. But when I change the display mode to a diferent resolution or bits per pixel, I get this error in the debug window when I release the DirectDraw objects: First-chance exception in VVC.exe (KERNEL32.DLL): 0xC0000005: Access Violation. The thread 0xFFF84CC9 has exited with code 0 (0x0). The program 'C:\VVC\Debug\VVC.exe' has exited with code 0 (0x0). Any ideas? Thank you in advance. Topgoro Edited by - Topgoro on 9/7/00 12:09:46 PM
We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.
SteveBrown
SteveBrown
Does this happen with other DirectX games/programs also? or just the one your working on? Maybe you need to re-install dx or something
Eric
Eric
Well, I dunno how this would relate to changing the display modes, but I think you can get an access violation error if you try to release an uninitialized object. Generally I do something like this:

LPDIRECTDRAW7 m_pDD = NULL;

// initialize m_pDD or whatever

SAFE_RELEASE( m_pDD ); // this won''t call m_pDD->Release() if m_pDD is still NULL
VBMaster
VBMaster
Maybe you don''t restore the original display mode before releasing the object...?

VBMaster
Topgoro
Topgoro
Hi.

Thank you for your responses.

I tried Steves recomendation but reinstallind DX did not help, I also using a template to the same effect as Eric''s recomendation, and VBMaster, I did try to restore the video mode bycalling the DIrectDraw''s "RestoreDisplayMode" function but it did not help. I anycase, the DirectDraw documentation says you don''t need to do that call (it even recomends you against making the call in the first place), as the display mode is automatically restored when you release direct draw objects.

I also compiled one of the SDK samples (multimon) and I did not get 1, but 2 exceptions (again these exception messages appear in the debug output, and not as a regular Windows "this application blablabla" dialog boxes).

SO I guess it''s not my programs problem, but something driver or otherwise related.

Thank you
We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.
SteveBrown
SteveBrown
I just thought of something else that might cause an error.

Did you set the cooperative level to fullscreen exclusive mode? If you leave this out in a program I think you get an error like the one you described.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.