public static void AdaptWindowToWorkingArea(this IntPtr windowHandle, int?taskbarHeight = null) { SEBWindowHandler.EditWindowByHandle(windowHandle, SEBWindowHandler.ShowWindowCommand.SW_SHOWNORMAL, false); if (taskbarHeight.HasValue) { IntPtr hWnd = windowHandle; int X = 0; int Y = 0; Rectangle bounds = Screen.PrimaryScreen.Bounds; int width = bounds.Width; bounds = Screen.PrimaryScreen.Bounds; int nHeight = bounds.Height - taskbarHeight.Value; int num = 1; SEBWindowHandler.MoveWindow(hWnd, X, Y, width, nHeight, num != 0); } else { IntPtr hWnd = windowHandle; int X = 0; int Y = 0; Rectangle rectangle = Screen.PrimaryScreen.Bounds; int width = rectangle.Width; rectangle = Screen.PrimaryScreen.WorkingArea; int height = rectangle.Height; int num = 1; SEBWindowHandler.MoveWindow(hWnd, X, Y, width, height, num != 0); } SEBWindowHandler.EditWindowByHandle(windowHandle, SEBWindowHandler.ShowWindowCommand.SW_SHOWMAXIMIZED, false); }
public static void RestoreHiddenWindows() { foreach (IntPtr hiddenWindowHandle in SEBWindowHandler._hiddenWindowHandles) { SEBWindowHandler.EditWindowByHandle(hiddenWindowHandle, SEBWindowHandler.ShowWindowCommand.SW_RESTORE, false); } }
private static void EditAllOpenWindows(SEBWindowHandler.ShowWindowCommand action) { foreach (KeyValuePair <IntPtr, string> openWindow in (IEnumerable <KeyValuePair <IntPtr, string> >)SEBWindowHandler.GetOpenWindows()) { IntPtr key = openWindow.Key; if (!key.IsAllowed()) { SEBWindowHandler.EditWindowByHandle(key, action, false); } } }
public static void BringToTop(this IntPtr windowHandle, bool restoreIfMinimizedOrHidden = true) { SEBWindowHandler.SetForegroundWindow(windowHandle); SEBWindowHandler.BringWindowToTop(windowHandle); int showCmd = windowHandle.GetPlacement().showCmd; if (!restoreIfMinimizedOrHidden || showCmd != 2 && showCmd != 0) { return; } SEBWindowHandler.EditWindowByHandle(windowHandle, SEBWindowHandler.ShowWindowCommand.SW_RESTORE, false); }
public static void MaximizeWindow(this IntPtr windowHandle) { SEBWindowHandler.EditWindowByHandle(windowHandle, SEBWindowHandler.ShowWindowCommand.SW_SHOWMAXIMIZED, false); }
public static void MinimizeWindow(this IntPtr windowHandle, bool waitForShowingUp = false) { SEBWindowHandler.EditWindowByHandle(windowHandle, SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED, waitForShowingUp); }
public static void HideWindow(this IntPtr handle) { SEBWindowHandler.EditWindowByHandle(handle, SEBWindowHandler.ShowWindowCommand.SW_HIDE, false); }