Skip to main content
gamedev.net
🔒 Locked

Running code after DestroyWindow

Started by mortex Mar 13, 2003 at 2:25 PM 2 replies 300+ views
Original Post
mortex
mortex
Hi, I have created a very basic opengl-framework but when I''m closing it down, no code is run after DestroyWindow. Is this normal? is there anything I could do to avoid this? Im just hiding the window now, but this is not what i want to do. (it should leave control back to main()) Any thoughts? - Morten
Promit
Promit
Do you call PostQuitMessage in WM_DESTROY and then exit when you get WM_QUIT message?

If you want to keep running, don''t post a quit message.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Henri
Henri
I have spent my entire morning tracking a bugg. I ended up having o rewrite my entire window handling and opengl initialization code due to some very weird and random buggs. And now I know the reason, my managing of windows messages was well not very good. So my advice is: Make sure you handle your window messages correctly!!!

For example. You could start closing you app when you receive the WM_CLOSE and not when you receive the WM_DESTROY. WM_DESTORY is sent when the window has been/are being destroyed. So it’s a good idea to close it before that or you will end up having trouble releasing rending contexts as well as your HWND…

You might want to take a look at nehe''s first tutorial. Just to see in witch order he deals with messages and application shutdown...
daerid
daerid
Why not just run the code in question after the message loop terminates, but before the program exits? Seems simple enough to me...
daerid@gmail.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.