编程语言
首页 > 编程语言> > C# 控制系统任务栏的显示与隐藏

C# 控制系统任务栏的显示与隐藏

作者:互联网

 

 

[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int ShowWindow(int hwnd,int nCmdShow);

private const int SW_HIDE = 0;
private const int SW_RESTORE = 9;

 

/// <summary>
/// 方法
/// </summary>
/// <param name="whether">是否显示</param>
public void HideorShow(bool whether)
{
if (whether == false)
{
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE);//隐藏
}
else
{
ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);//显示
}
}

 

标签:C#,DllImport,SW,控制系统,int,ShowWindow,FindWindow,任务栏,public
来源: https://www.cnblogs.com/qingningmeng/p/16062477.html