Boolean out of binary operation?

Just starting out? Need help? Post your questions and find answers here.
highend
Enthusiast
Enthusiast
Posts: 125
Joined: Tue Jun 17, 2014 4:49 pm

Boolean out of binary operation?

Post by highend »

Hi,

e.g.:

Code: Select all

  isOwned              = GetWindow_(hwnd, #GW_OWNER)
  hasAppwindowExStyle  = GetWindowLong_(hwnd, #GWL_EXSTYLE) & #WS_EX_APPWINDOW
  hasToolwindowExStyle = GetWindowLong_(hwnd, #GWL_EXSTYLE) ! #WS_EX_TOOLWINDOW
If a window has the ExStyle #WS_EX_APPWINDOW, hasAppwindowExStyle should contain #True and
not 262144 as it contains now

The same for the ExStyle #WS_EX_TOOLWINDOW and #GW_OWNER flag. Their variables should get
a single #False / #True...

How do I do this?
Fred
Administrator
Administrator
Posts: 16680
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Boolean out of binary operation?

Post by Fred »

You can try by using the Bool() compiler function:

Code: Select all

hasAppwindowExStyle  = Bool(GetWindowLong_(hwnd, #GWL_EXSTYLE) & #WS_EX_APPWINDOW)
hasToolwindowExStyle = Bool(GetWindowLong_(hwnd, #GWL_EXSTYLE) ! #WS_EX_TOOLWINDOW)
highend
Enthusiast
Enthusiast
Posts: 125
Joined: Tue Jun 17, 2014 4:49 pm

Re: Boolean out of binary operation?

Post by highend »

Thank you, Fred!
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Boolean out of binary operation?

Post by RSBasic »

@highend
Tip: Please use GetWindowLongPtr_() instead of GetWindowLong_().
Image
Image
highend
Enthusiast
Enthusiast
Posts: 125
Joined: Tue Jun 17, 2014 4:49 pm

Re: Boolean out of binary operation?

Post by highend »

@RSBasic

Will do so, thanks for the hint :mrgreen:
Post Reply