I'm writing a wrapper around the Win32 API. I have a class for editing a window, this class has methods for getting/setting the location, text, window styles, ect. This is what I have for the GetStyles method:
In addition to that, WS_OVERLAPPEDWINDOW is in fact a combination of flags. So if you only do & if will give you a false positive if any of those flags are set.
For example:
1 2 3 4 5 6 7
int style = WS_SYSMENU;
if(style & WS_OVERLAPPEDWINDOW)
{
// this block will execute, because WS_SYSMENU is part of WS_OVERLAPPEDWINDOW
// and therefore the & returns nonzero
}
To check for the whole WS_OVERLAPPEDWINDOW style, you need to make sure that all the WS_OVERLAPPEDWINDOW flags are set. You do this with a combination of & and ==: