Toggling to Fullscreen in Windows 7.

Started by
6 comments, last by EnlightenedOne 13 years, 5 months ago
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.

Half Full Screen

Its got 1024, 768 display in a 1280, 1024 screen. However its not changed the resolution of the window.
Advertisement
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...
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?
You can get the main monitor dimensions with GetSystemMetrics(SM_CXSCREEN/SM_CYSCREEN).
Quote:Original post by EnlightenedOne
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?


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.
Ah so the device needs a reset! Thanks very much!
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.
Lots of state logic later resetting the device did the trick!

Thanks for your help everyone!

This topic is closed to new replies.

Advertisement