C# 显示及隐藏任务栏

时间:2021-07-22 17:01:39   收藏:0   阅读:1

封装

private const int SW_HIDE = 0; //隐藏任务栏
private const int SW_RESTORE = 9;//显示任务栏

[DllImport("user32.dll")]
public static extern int ShowWindow(int hwnd, int nCmdShow);
[DllImport("user32.dll")]
public 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);
}

//网络素材仅限收藏 方便学习

原文:https://www.cnblogs.com/New-HackerHK/p/15043868.html

评论(0
© 2014 bubuko.com 版权所有 鲁ICP备09046678号-4
打开技术之扣,分享程序人生!