Example #1
0
 /// <summary>
 /// Tests whether one window is a child of another
 /// </summary>
 /// <param name="parent">Parent window</param>
 /// <param name="window">Window to test</param>
 /// <returns></returns>
 public static bool IsChild(Win32Window parent, Win32Window window)
 {
     return IsChild(parent._handle, window._handle);
 }
Example #2
0
        /// <summary>
        /// Gets a value indicating whether a form of the specified type is currently visible in this process.
        /// </summary>
        public static bool ModalDialogIsVisible()
        {
            int currentProcess = Process.GetCurrentProcess().Id;
            IntPtr mainWindowHandle = Process.GetCurrentProcess().MainWindowHandle;
            bool output = false;

            EnumWindows(delegate(IntPtr handle, int i)
            {
                Win32Window w = new Win32Window(handle);
                if (w.ProcessId == currentProcess)
                {
                    Form f = Form.FromHandle(w.Handle) as Form;

                    if (f != null && w.Handle != mainWindowHandle && f.GetType().Namespace.StartsWith("XenAdmin"))
                    {
                        output = true;
                        return false;
                    }
                }
                return true;
            }, 0);

            return output;
        }
Example #3
0
 /// <summary>
 /// Tests whether one window is a child of another
 /// </summary>
 /// <param name="parent">Parent window</param>
 /// <param name="window">Window to test</param>
 /// <returns></returns>
 public static bool IsChild(Win32Window parent, Win32Window window)
 {
     return(IsChild(parent._handle, window._handle));
 }