Once again I am astounded that such a simple, yet important API exists but is undocumented. I am talking about the IsTopLevelWindow function which is exported from user32.dll. As the name suggests it determines if a given window is a top-level window. I inspected User32.dll on Windows 7 and Windows 8.1 where it was present. Other Operating Systems may be supported. Enough talking! Here is the documentation, in MSDN style for you Redmond guys 😉
BOOL WINAPI IsTopLevelWindow ( _In_ HWND hWnd );
- hWnd [in, optional]
- Type: HWNDA handle to the window.