Advertisement

NeHe Tutorial #1 fullscreen / window switch fails

Started by June 27, 2003 11:10 AM
1 comment, last by spirogyra 21 years, 8 months ago
This is the blank window demo. Under 98SE, when you press F1, which causes a call to KillWindow() then a call to CreateGLWindow(), the first fullscreen or framed window is not destroyed, and you get the error "Failed to Register the Window class. KillWindow does not report any problems and also fails to destroy the original window. By avoiding trying to register the window class a second time, which is not really needed, I can get one fullscreen and one framed window. If I kept pressing F1, I''d probably get a lot more. I''m working on seperating the RegisterClass and CreateGLWindow code, but has anyone already solved this problem? The problem might not occur in all versions of Windows or with all compilers. I''m using GnuCC with MinGW. BTW, this requires explicit calls to LoadLibrary() for each non-gnu DLL used and GetProcAddress() for each function in a non-gnu dll used.
You may want to take another look at your code. The KillGLWindow() function in Lesson 1 does call DestroyWindow() and UnregisterClass().
Advertisement
I will continue to look through the code, sorry to not have any copied in here. I''m moving (twice) and the pc with the code is not the pc with a connection right now. I might have mis-transcribed something. I''m downloading a copy in source form instead of tutorial form.

The strange thing is the window does not get killed during an F1 switch, so I''m wondering if the current problem (which I may have created) is keeping KillWindow() from working properly and that DefWindowProc() is actually killing it on program exit.

I kept all of the if(!UnregisterClass(...)){...return FALSE;} type tests in WinMain(), and all of KillWindow()''s tests pass and report no errors.

Things I''m going to experiment with even if it''s just a typo ;-) are: seperate WNDCLASS wc registration from window creation as above and manually empty the message queue when killing a window. Any other suggested housekeeping? I''d like to learn all I can to make resolution switches as smooth as possible.

This topic is closed to new replies.

Advertisement