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); }