Archived

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

PPCThug

will if (!handle to window1 && !handle to window2) work?

Recommended Posts

the idea was to check if both windows where closed and if so PostQuitMessage(0); Please be patient I''m a newbie!
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.

Share this post


Link to post
Share on other sites
Yes.

&& will evaluate to true if all the conditions are met. || will evaluate to true if ANY of the conditions are met. I believe, with &&, you can count on the order of execution being left to right. So, you can do things like:

    
char *sptr;
...
if (sptr != 0 && *sptr == 't')


If sptr is 0, you certainly don't want to do *sptr. But, checking first for sptr != 0 allows you to safely deference sptr in a single condition like this.

Edited by - OldGuy on January 31, 2002 6:54:45 PM

Share this post


Link to post
Share on other sites
The operators && || and , are always evaluated left to right, unless you overload them, in which case it is implementation-defined, being directly dependent on the order of evaluation of function parameters.

Note also, that && and || do ''shortcut evaluation''.
That is, once the value of the expression is determined, the remaining terms won''t be evaluated.

So once you have a ''false'' argument to && or a ''true'' argument to ||, the result is decided, and the remaining terms are ignored.

Which enables you to write things like
if (ptr!=NULL && *ptr!=0) 

Share this post


Link to post
Share on other sites
If I understand you, this won''t work to check if the window is still ''alive''. Rather than just check the HWND values, you want to call IsWindow() to check that, although you can still put them into a single if statement:

if( !IsWindow( hwnd1 ) && !IsWindow( hwnd2 ) )
... // Both windows are dead


--
Eric

Share this post


Link to post
Share on other sites
thanks for all the help!



the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.

Share this post


Link to post
Share on other sites