Click to See Complete Forum and Search --> : ChangeDisplaySettings is causing a blanks screen.


Calculator
December 3rd, 2006, 04:10 AM
I have a very small section of code that is confusing me, and seems to be causing a blackscreen. The codey goes something like this:

DEVMODE dm = { 0 };
LONG ret = 0; DWORD i = 0;


dm.dmSize = sizeof(DEVMODE);
dm.dmDriverExtra = 0;

while( ::EnumDisplaySettings( 0, i, &dm ) )
{
if(dm.dmPelsHeight == 600 &&
dm.dmPelsWidth == 800 &&
dm.dmBitsPerPel == 32)
{
ret = 1;
break;
}
i++;
}

if(ret)
{
dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
ret = ::ChangeDisplaySettings( &dm, CDS_FULLSCREEN );
if( ret != DISP_CHANGE_SUCCESSFUL ) // Blarhgfadgigafdg.
}

When my current screen resolution in 800 x 600, and it is changing into fullscreen that way, this works, and I get stuff (things rendered by opengl) to show on the screen. However, when it is not, it says DISPLAY_CHANGE_SUCCESSFUL but of course I can not see anything being rendered. Is there a better way I should approach this?

Calculator
December 3rd, 2006, 03:14 PM
Or um, is there any other information/code I could give you guys to help you guys figure out the cause? I can see the cursor. So, it's not just completely busted. Kinda relevant?