Beispiel #1
0
        /// <summary>
        /// Verifies whether the window can be activated
        /// </summary>
        /// <param name="hWnd">WIndow handle</param>
        /// <returns>true if it can</returns>
        private static bool canBeActivated(IntPtr hWnd)
        {
            if (isShellWindow(hWnd))
            {
                return(false);
            }

            var root = User32Interop.GetAncestor(hWnd, User32Interop.GetAncestorFlags.GetRootOwner);

            if (getWindowPopup(root) != hWnd)
            {
                return(false);
            }

            var className = Windows.GetWindowClassName(hWnd);

            if (String.IsNullOrEmpty(className))
            {
                return(false);
            }

            if (Array.IndexOf(_ignoreClassNames, className) > -1)
            {
                return(false);
            }

            if (className.StartsWith("WMP9MediaBarFlyout"))
            {
                return(false);
            }

            return(true);
        }