Exemple #1
0
        private static bool IsValidWindow(IntPtr hWnd)
        {
            // Basic WS_VISIBLE check
            if (!NativeMethods.IsWindowVisible(hWnd))
            {
                return(false);
            }
            // Actually visible?
            if (!NativeMethodsHelper.IsActiveAndReallyVisibleTopLevelWindow(hWnd))
            {
                return(false);
            }
            // Remove notification icon programs and "Program Manager"
            if (NativeMethodsHelper.IsProgramManagerOrHiddenTrayWindow(hWnd))
            {
                return(false);
            }
            // Not a tool window
            if (NativeMethodsHelper.IsToolWindow(hWnd))
            {
                return(false);
            }
            // Not cloaked
            if (NativeMethodsHelper.IsWindowCloaked(hWnd))
            {
                return(false);
            }

            return(true);
        }