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:
Code:
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 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?