Archived

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

Ashmin007

How to close one window at a time.

Recommended Posts

Ashmin007    122
I''d been studying TOWGPG for the last few days. I am stuck at the end of chapter 2(page 92). I could''t figure out a way to close one window at a time for example 2.5. Does anyone knows how to do that?

Share this post


Link to post
Share on other sites
microdot    324
Since they all use the same window procedure this is what you can do. Add the following variable to the beginning of the window procedure.

static int window_count = 0;

For the WM_CREATE message add

window_count++;

And in the WM_DESTROY case write

window_count--;
if (window_count <= 0)
{
PostQuitMessage (0);
}
return 0;

Now the application won't shutdown until the last window is closed.




[edited by - microdot on March 5, 2003 11:37:33 PM]

Share this post


Link to post
Share on other sites