Perhaps checking the window's style for a title bar will do what you want:
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
static bool IsAppWindow(IntPtr hWnd)
{
int style = GetWindowLong(hWnd, -16); // GWL_STYLE
// check for WS_VISIBLE and WS_CAPTION flags
// (that the window is visible and has a title bar)
return (style & 0x10C00000) == 0x10C00000;
}
But this won't work for some of the fancier apps which are fully custom drawn.