Board index » cppbuilder » C++ equivalent of this Delphi line

C++ equivalent of this Delphi line


2007-03-21 02:07:51 AM
cppbuilder98
What is the C++ equivalent for the Delphi line:
Params.ExStyle := Params.ExStyle and not WS_EX_TOOLWINDOW or
WS_EX_APPWINDOW;
Is it
Params.ExStyle=Params.ExStyle & !WS_EX_TOOLWINDOW | WS_EX_APPWINDOW;
or
Params.ExStyle=Params.ExStyle & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW;
Just want to make sure. Thanks.
--
Albert Wiersch
 
 

Re:C++ equivalent of this Delphi line

Albert Wiersch wrote:
Quote
Params.ExStyle=Params.ExStyle & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW;

Just want to make sure. Thanks.

The latter.
 

Re:C++ equivalent of this Delphi line

"Albert Wiersch" < XXXX@XXXXX.COM >wrote in message
Quote
What is the C++ equivalent for the Delphi line:
Params.ExStyle := Params.ExStyle and not WS_EX_TOOLWINDOW or
WS_EX_APPWINDOW;
If you are trying to remove both styles, then it would be the
following:
Params.ExStyle = Params.ExStyle & ~(WS_EX_TOOLWINDOW |
WS_EX_APPWINDOW);
Or:
Params.ExStyle &= ~(WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);
On the other hand, if you are trying to remove one style and add the
other, then it would be the following instead:
Params.ExStyle = (Params.ExStyle & ~WS_EX_TOOLWINDOW) |
WS_EX_APPWINDOW;
Gambit
 

{smallsort}

Re:C++ equivalent of this Delphi line

Remy Lebeau (TeamB) wrote:
Quote
"Albert Wiersch" < XXXX@XXXXX.COM >wrote in message

If you are trying to remove both styles, then it would be the
following:

[snip]

Or:

Params.ExStyle &= ~(WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);

I'm not shure that this will work if Params.ExStyle is a property.
Actually I'm almost shure it won't.
--
Please remove "sam_" from email address.
 

Re:C++ equivalent of this Delphi line

"Sam" < XXXX@XXXXX.COM >wrote in message
Quote
I'm not shure that this will work if Params.ExStyle is a property.
It is not a property.
Gambit
 

Re:C++ equivalent of this Delphi line

Thanks all. I am now using this:
Params.ExStyle = (Params.ExStyle & ~WS_EX_TOOLWINDOW) | WS_EX_APPWINDOW;
I want to remove WS_EX_TOOLWINDOW and add WS_EX_APPWINDOW. The Delphi "not"
was confusing to me as I thought it might be "!" in C but in this case it
should be "~".
--
Albert Wiersch
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Albert Wiersch" < XXXX@XXXXX.COM >wrote in message
news:46002302$ XXXX@XXXXX.COM ...

>What is the C++ equivalent for the Delphi line:
>Params.ExStyle := Params.ExStyle and not WS_EX_TOOLWINDOW or
>WS_EX_APPWINDOW;

If you are trying to remove both styles, then it would be the
following:

Params.ExStyle = Params.ExStyle & ~(WS_EX_TOOLWINDOW |
WS_EX_APPWINDOW);

Or:

Params.ExStyle &= ~(WS_EX_TOOLWINDOW | WS_EX_APPWINDOW);

On the other hand, if you are trying to remove one style and add the
other, then it would be the following instead:

Params.ExStyle = (Params.ExStyle & ~WS_EX_TOOLWINDOW) |
WS_EX_APPWINDOW;


Gambit


 

Re:C++ equivalent of this Delphi line

"Albert Wiersch" < XXXX@XXXXX.COM >wrote in message
Quote
The Delphi "not" was confusing to me as I thought it might be "!" in
C
Sometimes, it is. For example:
while not Terminated do
while( !Terminated )
Quote
in this case it should be "~".
Yes, but only because the 'not' operator is being applied to a bitwise
operation.
Gambit