public static void Set_window_State(IntPtr app_hwnd, window_state win_state) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT(); GetWindowPlacement(app_hwnd, ref lpwndpl); lpwndpl.showCmd = (int)win_state; SetWindowPlacement(app_hwnd, ref lpwndpl); }
public static void Set_window_State(string Process_Name, window_state win_state) { foreach (Process process in Process.GetProcessesByName(Process_Name.Trim())) { WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT(); IntPtr mainWindowHandle = process.MainWindowHandle; GetWindowPlacement(mainWindowHandle, ref lpwndpl); lpwndpl.showCmd = (int)win_state; SetWindowPlacement(mainWindowHandle, ref lpwndpl); } }