public static IntPtr BringWindowToFront( string name, bool _, bool isRetoreMinimizedWindow = false) { IntPtr window = InteropWindow.FindWindow((string)null, name); if (window == IntPtr.Zero) { throw new SystemException("Cannot find window '" + name + "'", (Exception) new Win32Exception(Marshal.GetLastWin32Error())); } if (!InteropWindow.SetForegroundWindow(window)) { throw new SystemException("Cannot set foreground window", (Exception) new Win32Exception(Marshal.GetLastWin32Error())); } if (isRetoreMinimizedWindow) { InteropWindow.ShowWindow(window, 9); } else { InteropWindow.ShowWindow(window, 5); } return(window); }
public static IntPtr GetWindowHandle(string name) { IntPtr window = InteropWindow.FindWindow((string)null, name); if (!(window == IntPtr.Zero)) { return(window); } throw new SystemException("Cannot find window '" + name + "'", (Exception) new Win32Exception(Marshal.GetLastWin32Error())); }
public static IntPtr MinimizeWindow(string name) { IntPtr window = InteropWindow.FindWindow((string)null, name); if (window == IntPtr.Zero) { throw new SystemException("Cannot find window '" + name + "'", (Exception) new Win32Exception(Marshal.GetLastWin32Error())); } InteropWindow.ShowWindow(window, 6); return(window); }