Post by YuryPost by Norman Bullenif ((GetWindowLong(hWnd, GWL_STYLE)&
(WS_POPUP|WS_CHILD))==0) {
// it is overlapped
}
else {
// it is not overlapped
}
(This assumes a valid window handle; an invalid handle will look like an
overlapped window.)
Norm
It is wrong. Microsoft Spy++ show that window this style 0x94c00880 has
WS_POPUP and WS_OVERLAPPED style.
Test.
1) Create window with style 0x94c00880.
2) Run “Microsoft Spy++”. And we see that window has WS_POPUP and
WS_OVERLAPPED styles.
3) Now run your code. And we see that window does not have a WS_OVERLAPPED
style.
Actually, Microsoft Spy++ is wrong.
There are two bits in the window style that control its type. If the
high-order bit of the style DWORD is set, the window is a popup window.
If the next bit is set, the window is a child window. If neither is set,
the window is overlapped. (If both are set, the result is undocumented.)
Look at these definitions from WinUser.h.
#define WS_OVERLAPPED 0x00000000L
#define WS_POPUP 0x80000000L
#define WS_CHILD 0x40000000L
Your window style (0x94c00880) has the high-order bit set and the next
bit clear so it is a popup window, not an overlapped window.
The correct way to identify all three types of windows (this is what
Spy++ should do) is
dwStyle = GetWindowLong(hWnd, GWL_STYLE);
if (dwStyle&WS_POPUP) {
// it's a popup window
}
else if (dwStyle&WS_CHILD) {
// it's a child window
}
else {
// it's an overlapped window
}
Norm
--
--
To reply, change domain to an adult feline.