Is it to check for the WS_CHILD bit:
LONG style = GetWindowLong(hwnd, GWL_STYLE);
int isTopLevel = !(style & WS_CHILD);
Or is there a better way?
Assume: Straight C calling only existing Windows API code.
Is it to check for the WS_CHILD bit:
LONG style = GetWindowLong(hwnd, GWL_STYLE);
int isTopLevel = !(style & WS_CHILD);
Or is there a better way?
Assume: Straight C calling only existing Windows API code.
Way #1: Test hWnd==GetAncestor(hWnd,GA_ROOT)
Way #2: Use IsTopLevelWindow
(user32 Win7, undocumented)
The GetParent() API returns the parent or owner of the current window.
Your method is possible (But I think you had better to check if it is a overlapped/popup window too). There is maybe another way -- That is to enum all top level windows and to check if your windows is included in result.