# Toggling to Fullscreen in Windows 7.

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

## Recommended Posts

Hi there I am using DX9 and trying to toggle from windowed to fullscreen mode using the function below. I get relative success I have attached a photo. Something appears to be missing. This code worked on vista so I am wondering if there is a new something I need to call to resize the screens resolution.

			mutAccessData.lock();			if (boolWindowed == true)			{				//Not windowed, as soon as this is hit and the message pump interrupts this thread the fullscreen settings				//get overwritten.				boolWindowed = false;				//Set the windows handle to the fullscreen popup style (no border).				SetWindowLongPtr(hWnd, GWL_STYLE, WS_POPUP);				SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, intFSWidth, intFSHeight, 0);				//Display the screen with the new settings.				ShowWindow(hWnd, SW_SHOW);				mutAccessData.unlock();			}			else			{				//We are now using a window				boolWindowed = true;				//Set the windows handle to the windowed settings with a normal framed window.				SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);				//Put the window where we normally put it (accounting for half the frames pixels).				SetWindowPos(hWnd, HWND_NOTOPMOST, intLeft, intTop, intWWidth + WINDOWFRAMEWIDTH, intWHeight + WINDOWFRAMEHEIGHT, 0);				//Display the screen with the new settings.				ShowWindow(hWnd, SW_SHOW);				mutAccessData.unlock();			}

Here is a picture of what I am getting, halfway there.

Its got 1024, 768 display in a 1280, 1024 screen. However its not changed the resolution of the window.

##### Share on other sites
Probably the resolution of your PC with Windows 7 is higher than the PC with Vista

Change the value of intFSWidth, and intFSHeight to higher numbers...

##### Share on other sites
Ordinarily the resolution would automatically change to the smaller resolution of the window or at least thats the behaviour I would get in Vista. Is there a new window long ptr condition I need to add?

##### Share on other sites
You can get the main monitor dimensions with GetSystemMetrics(SM_CXSCREEN/SM_CYSCREEN).

##### Share on other sites
Quote:
 Original post by EnlightenedOneOrdinarily the resolution would automatically change to the smaller resolution of the window or at least thats the behaviour I would get in Vista. Is there a new window long ptr condition I need to add?

For that use the Reset method of your device instead. You shouldn't need to manually set the window style or position when switching to fullscreen with DX9.

##### Share on other sites
Ah so the device needs a reset! Thanks very much!

##### Share on other sites
It looks like you're just showing a large, borderless window.
For the real deal, you should try changing the display mode of the card.
For instance, forcing to 1024x768 will depend on the graphics card and the monitor mainly,
But this doesn't change anything but the resolution of the renvdered image.

##### Share on other sites
Lots of state logic later resetting the device did the trick!