You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
1 year ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Runtime.InteropServices;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace AksWebBrowser
|
||
|
{
|
||
|
public class SetTaskStatus
|
||
|
{
|
||
|
private const int SW_HIDE = 0; //隐藏任务栏
|
||
|
private const int SW_RESTORE = 9;//显示任务栏
|
||
|
|
||
|
[DllImport("user32.dll")]
|
||
|
private static extern int ShowWindow(int hwnd, int nCmdShow);
|
||
|
[DllImport("user32.dll")]
|
||
|
private static extern int FindWindow(string lpClassName, string lpWindowName);
|
||
|
|
||
|
/// <summary>
|
||
|
/// 显示任务栏
|
||
|
/// </summary>
|
||
|
public static void Showtask()
|
||
|
{
|
||
|
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 隐藏任务栏
|
||
|
/// </summary>
|
||
|
public static void Hidetask()
|
||
|
{
|
||
|
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
// 设置窗体的显示状态
|
||
|
[DllImport("user32.dll", SetLastError = true)]
|
||
|
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
|
||
|
int X, int Y, int cx, int cy, uint uFlags);
|
||
|
|
||
|
// 窗体的句柄
|
||
|
[DllImport("user32.dll")]
|
||
|
public static extern IntPtr GetForegroundWindow();
|
||
|
|
||
|
public const uint SWP_SHOWWINDOW = 0x0040;
|
||
|
public const uint SWP_NOSIZE = 0x0001;
|
||
|
public const uint SWP_NOMOVE = 0x0002;
|
||
|
public const uint TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW;
|
||
|
}
|
||
|
}
|