How do I find a window's styles (How do I 'reverse' bitwise or)?

Hi,

I am trying to find whether a window possesses a particular style. So, for a window with the handle hwnd, I use:

DWORD styles=GetWindowLongPtr(hwnd,GWL_STYLE);

This should give me the styles DWORD. My puzzle is how I then work out whether a particular style is present - for example whether the window has a vertical scroll bar.

Since the styles DWORD is constructed out of bitwise or operations when the window is created, I am after a test to see whether a particular constant was one of the constants that was 'bitwised ored' (hopefully you understand what I mean!). How would one do this in general?

*Please also tell me if I have overlooked a simpler way of checking if a window has a particular style!
To check if a flag exist: if ( flags & flag == flag )
use bitwise AND:
1
2
3
4
if(styles & WS_SOMESTYLE)
    cout <<"WS_SOMESTYLE was set";
else cout <<"Style wasn't set";


EDIT: I'm slow
Last edited on
Great! Thanks!
Topic archived. No new replies allowed.