Jump to content
  • Advertisement
Sign in to follow this  
johnny_no1_boy

How to Toggle from Fullscreen to Windowed Mode?

This topic is 3917 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

Hello.I'm trying to toggle from fullscreen mode to windowed mode with the following code: SetWindowLong(hWnd,GWL_style,WS_POPUP); VideoCard_Parameters.Windowed = true; VideoCard_Parameters.BackBufferWidth = 500; VideoCard_Parameters.BackBufferHeight = 400; SetWindowPos(hWnd,HWND_NOTOPMOST,stylejukebox_window_size_x,stylejukebox_window_size_y,stylejukebox_window_startposition_x,stylejukebox_window_startposition_y,SWP_SHOWWINDOW); if(FAILED(VideoCard_Device->Reset(&VideoCard_Parameters))) { .... } -- If I'm trying to toggle from fullscreen to windowed mode the device reset fail.why?

Share this post


Link to post
Share on other sites
Advertisement
The debug runtimes will tell you. What error code does Reset() return? What are the values of all of your present params? Is the backbuffer format compatible with the display format in windowed mode?

Share this post


Link to post
Share on other sites
The application goes from windowed mode to fullscreen mode.But is not returning from fullscreen mode to windowed mode.The presentation parameters are the same (and are compatible) I only modify some things on going fullscreen and some things on going windowed mode.

How can I get Debug information?

Share this post


Link to post
Share on other sites
You need to enable the debug runtimes, which can be done from the DirectX Control Panel. If you have a recent SDK, it's in Start Menu -> Programs -> DirectX SDK -> DirectX Utilities -> DirectX Control Panel, and if you have an older SDK it'll be in the Windows Control Panel.
In either case, go to the Direct3D tab and select "Use Debug Version of Direct3D", and put the debug output level up to maximum.

Then, when any D3D call fails, you'll get a useful error message in the visual studio debug output window.

Also, a little off-topic, you should be changing the window style after resetting the device (Since D3D will probably change the window style on reset), and you should be passing the SWP_FRAMECHANGED flag to SetWindowPos() to tell it that the frame needs updated.

Share this post


Link to post
Share on other sites
I must put:
VideoCard_Parameters.FullScreen_RefreshRateInHz = 0;

My current resolution is 1024x768.The application goes in 800x600 and when it's returning is positioned in the left-up part of the screen.How can I make it to be in the center.

And if the application goes in 1024x768 it's not returning in windowed mode because the resolution is the same

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!