Computing.Net > Forums > Programming > Two windows, close one at a time

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Two windows, close one at a time

Reply to Message Icon

Name: SamColes
Date: October 29, 2002 at 05:06:12 Pacific
OS: Windows XP
CPU/Ram: 1ghz Pentium 3, 128mb RAM
Comment:

info that might be of help--
Compiler: VC++ 6.0
Problem to do with: Win32 SDK
OS: Windows XP


Hi,

At the moment I'm reading Sams Tricks of the Windows Game Programming Gurus, I'm just on chapter two (Actually, I got to the end of the DirectX stuff but felt I rushed through and skipped bits I didn't understand so went back to the beginning again)

Anyway, I've just finished the second chapter. At the end of this chapter it gives you a little task to try. Which is to modify the code on the accompanying CD so that two windows open but make it so only one closes at a time.

I made two window classes (WNDCLASSEX) winclass and winclassx, registered both and then created two windows using them.

When a WM_DESTROY message is sent to my windows procedure function, I increment a global (int AmountClosed) then check, if AmountClosed == 2 then PostQuitMessage(0).

However, when I close one, they both close! Has WindowsXP decided to stop programs from doing this or something?




Sponsored Link
Ads by Google

Response Number 1
Name: SamColes
Date: October 29, 2002 at 05:08:45 Pacific
Reply:

I think I'm going to kill myself!

I was doing this:

[code]
case WM_DESTROY:
{
NumberClosed++;

if(NumberClosed = 2)
PostQuitMessage(0);

return(0);
} break;
[/code]

I only put one = sign, and 2 is true so...

I've changed it to == now. Thanks to anyone who was going to help anyway!!! :P


0
Reply to Message Icon

Related Posts

See More


Visual Basic 6.0 JavaScript



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Two windows, close one at a time

Moving Files one at a time www.computing.net/answers/programming/moving-files-one-at-a-time/11177.html

function fork() to Windows NT www.computing.net/answers/programming/function-fork-to-windows-nt/60.html

Any tips you can give on building a PC? www.computing.net/answers/programming/any-tips-you-can-give-on-building-a-pc-/2111.html