/// <summary> /// 用指定类型展现窗口 /// </summary> /// <param name="hWnd">窗口句柄</param> /// <param name="showType">展现类型</param> public static void ShowWindow(IntPtr hWnd, WindowShowType showType) { if (WindowApi.IsWindow(hWnd)) { WindowApi.ShowWindowAsync(hWnd, (int)showType); } }
/// <summary> /// 展示窗口 /// </summary> /// <param name="hWnd">窗口句柄</param> /// <remarks><paramref name="hWnd"/>为窗口句柄,而非进程句柄</remarks> public static void SwitchToWindow(IntPtr hWnd) { if (WindowApi.IsWindow(hWnd)) { WindowApi.ShowWindowAsync(hWnd, (int)WindowShowType.SW_SHOWMAXIMIZED); WindowApi.SetForegroundWindow(hWnd); } }