#### Archived

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

# Switching between Windowed & Fullscreen modes...

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

## 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 on other sites
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 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...

1. 1
Rutin
38
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633350
• Total Posts
3011473
• ### Who's Online (See full list)

There are no registered users currently online

×