0

I'm sure this question has been asked before, but I really don't know what it's called that I am trying to do, so I am having trouble researching it.

I am trying to output the extended styles of a window to the console. So, for example, if I call GetWindowLong on a test window, it will return the value 768 (0x300). My problem is, I know the window has multiple styles OR'd together, but I don't know how to decipher which ones have been OR'd together to result in 768.

For example, if the program used

WS_EX_TRANSPARENT | WS_EX_TOPMOST

(0x20L and 0x08L respectively), that would result in 0x28. How could I determine that 0x28 was in fact WS_EX_TRANSPARENT | WS_EX_TOPMOST?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
LegitGodmode
  • 39
  • 1
  • 6
  • using `&` (bitwise AND operator). I.e. `bool bHasFlag = 0 != (flags & MY_FLAG);` – valdo Nov 28 '17 at 06:59
  • You need to learn how integer bits and bitwise operators work. And then read MSDN's documentation on which style flags correspond to which bits for the types of window classes you are querying (hint: different window classes can use the same bits for different styles) – Remy Lebeau Nov 28 '17 at 08:00
  • Any chance you can points me in the right direction? I (generally) understand how bitwise operators work. – LegitGodmode Nov 28 '17 at 08:10
  • `if (style & WS_EX_TRANSPARENT)` .... – Michaël Roy Nov 28 '17 at 08:41

0 Answers0