Archived

This topic is now archived and is closed to further replies.

switching between fullscreen and windows

This topic is 5590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi! i have a problem to switch between fullscreen and window while the application is running. i know how to do it before i start the application, i do it like this:
      
	switch(cScreenMode)
	{
		case 0: { if(!(hWnd = CreateWindow("app", "app", WS_OVERLAPPED | WS_SYSMENU | WS_VISIBLE, 0, 0, cResolutionX, cResolutionY, NULL, NULL, hInstance, NULL))) { return(0); } } break;
		case 1: { if(!(hWnd = CreateWindow("app", "app", WS_POPUP | WS_VISIBLE, 0, 0, cResolutionX, cResolutionY, NULL, NULL, hInstance, NULL))) { return(0); } } break;
	}
      
how do I do it while the app is running? [edited by - delbogun on August 28, 2002 7:47:00 AM] [edited by - delbogun on August 28, 2002 7:47:40 AM]

Share this post


Link to post
Share on other sites
no, i mean... i''ve already have created the window that will act as fullscreen or window. i can''t use createwindow again every time the user presses alt+enter
is there a way to change the flags while the app is running?

Share this post


Link to post
Share on other sites
Hi

You have to use the ChangeDisplaySettings function for this.
i do it like this:


  

bool EnterFullscreen ()
{
DEVMODE newSettings;
// now fill the DEVMODE with standard settings, mainly monitor frequenzy

EnumDisplaySettings ( NULL, 0, &newSettings );
// set desired screen size/res

newSettings.dmPelsWidth = 800;
newSettings.dmPelsHeight = 600;
newSettings.dmBitsPerPel = 16;
// set those flags to let the next function know what we want to change

newSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
// and apply the new settings

if (ChangeDisplaySettings(&newSettings,CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL )
return false; // in case of error

else return true;
}

// and to reset the screen on program exit:


void ResetScreen ()
{
// this resets the screen to the registry-stored values

ChangeDisplaySettings ( NULL, 0 );
}



that works for me and sets my OpenGL-enabled windows into fullscreen mode...hope it works for you too

Edit: forgot source tags




------------
Runicsoft

[edited by - Burning_Ice on August 28, 2002 9:56:46 AM]

Share this post


Link to post
Share on other sites