public static API_GuiAutomation_NativeMethods.Rect windowRectangle(this API_GuiAutomation guiAutomation, int windowHandle)
        {
            var rect = new API_GuiAutomation_NativeMethods.Rect();

            API_GuiAutomation_NativeMethods.GetWindowRect(windowHandle, out rect);
            return(rect);
        }
        public static API_GuiAutomation_NativeMethods.Rect windowRectangle(this Window window)
        {
            var rect = new API_GuiAutomation_NativeMethods.Rect();

            API_GuiAutomation_NativeMethods.GetWindowRect(window.handle(), out rect);
            return(rect);
        }
        public static API_GuiAutomation alwaysOnTop(this API_GuiAutomation guiAutomation, int windowHandle, bool value)
        {
            guiAutomation.window_Normal(windowHandle);                          // make sure the window is not minimized

            var HWND_TOPMOST   = new HandleRef(null, new IntPtr(-1));
            var HWND_NOTOPMOST = new HandleRef(null, new IntPtr(-2));


            HandleRef hWndInsertAfter = value ? HWND_TOPMOST : HWND_NOTOPMOST;

            API_GuiAutomation_NativeMethods.SetWindowPos(windowHandle, hWndInsertAfter, 0, 0, 0, 0, 3);
            return(guiAutomation);
        }
        public static Window alwaysOnTop(this Window window, bool value)
        {
            var windowHandle = window.handle();

            window.restored();                          // make sure the window is not minimized

            var HWND_TOPMOST   = new HandleRef(null, new IntPtr(-1));
            var HWND_NOTOPMOST = new HandleRef(null, new IntPtr(-2));


            HandleRef hWndInsertAfter = value ? HWND_TOPMOST : HWND_NOTOPMOST;

            API_GuiAutomation_NativeMethods.SetWindowPos(windowHandle, hWndInsertAfter, 0, 0, 0, 0, 3);
            return(window);
        }
 public static API_GuiAutomation moveWindow(this API_GuiAutomation guiAutomation, int windowHandle, int left, int top, int width, int height)
 {
     API_GuiAutomation_NativeMethods.MoveWindow(windowHandle, left, top, width, height, true);
     return(guiAutomation);
 }