switching between fullscreen and windows

Started by
5 comments, last by delbogun 21 years, 7 months ago
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]
Advertisement
Use a boolean variable, say bFullScreen, and handles WM_KEYUP (or WM_KEYDOWN) to check for Alt-Enter?
"after many years of singularity, i'm still searching on the event horizon"
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?
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]
thanks alot
Does that solve the problem of needing to change the window''s attributes?

(WS_OVERLAPPED | WS_SYSMENU | WS_VISIBLE to WS_POPUP | WS_VISIBLE)
It's not what you're taught, it's what you learn.
nope, you still have to use WS_POPUP or else it shows the window''s title bar

This topic is closed to new replies.

Advertisement