will if (!handle to window1 && !handle to window2) work?
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.
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:
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
&& 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
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
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)
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
if( !IsWindow( hwnd1 ) && !IsWindow( hwnd2 ) )
... // Both windows are dead
--
Eric
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement