Jump to content
  • Advertisement

Archived

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

Switching between Windowed & Fullscreen modes...

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

I''ve been having a bit of trouble switching between windowed mode & fullscreen mode... I can manage to switch using Alt+Enter using something like this:
	case WM_SYSKEYDOWN:
		switch(wParam){
		case 13:								//Alt + Enter
			OpenGL.KillWindow();
			if(!OpenGL.NewWindow("GL Test",640,480,16,16,!OpenGL.GetFullScreenFlag())){
				exit(1);
			}

			OpenGL.Init();
			break;
		}
		return(0);
 
(email me if you want the complete code... it''s kinda long) The problem is that after switching back-and-forth a couple times it just dies... (It''s unable to activate the Rendering Context). Have you guys ever dealt with a problem like this before? I''m kinda new to win32 programming, so i suspect i''ve done something funny...

Share this post


Link to post
Share on other sites
Advertisement
I''ve had something like this happen before, but it was during my multithreading test. Anyway, I had to split up my window creation and device context creation into two different threads.

What was happening was that the window didn''t have enough time to create itself again. I didn''t have a message box for that error (window handle invalid...shouldn''t happen, since the thread is created on the WM_CREATE from the window itself), so it took me a while to track it down. What I did to fix it is put the thread to sleep for about 5 seconds and then check the window handle again. It hasn''t failed yet.

That may not be the RIGHT solution, but it worked for me.

Share this post


Link to post
Share on other sites
hmm... thanks, i''ll try that... maybe a sleep(0) will give the system a bit of time to cleanup between operations...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!