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

     /// <summary>
/// 获取窗体的句柄函数
/// </summary>
/// <param name="lpClassName">窗口类名</param>
/// <param name="lpWindowName">窗口标题名</param>
/// <returns>返回句柄</returns>
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        /// <summary>
/// 显示任务栏 && 开始菜单
/// </summary>
public static void ShowTask()
{
//显示任务栏
ShowWindow((int)FindWindow("Shell_TrayWnd", null), SW_RESTORE);
//显示系统开始菜单栏按钮
ShowWindow((int)FindWindow("Button", null), SW_RESTORE);
} /// <summary>
/// 隐藏任务栏 && 开始菜单
/// </summary>
public static void HideTask()
{
//隐藏任务栏
ShowWindow((int)FindWindow("Shell_TrayWnd", null), SW_HIDE);
//隐藏系统开始菜单栏按钮
ShowWindow((int)FindWindow("Button", null), SW_HIDE);
}
05-23 11:05