解决方案 »

  1.   

    试试这样:
     #region 隐藏任务栏与任务管理器
            [DllImport("user32.dll", EntryPoint = "FindWindowA")]
            public static extern IntPtr FindWindowA(string lp1, string lp2);//获取任务栏        [DllImport("user32.dll", EntryPoint = "ShowWindow")]
            public static extern IntPtr ShowWindow(IntPtr hWnd, int _value);//显示/隐藏任务栏
            /**/
            /// <summary>
            /// 是否屏蔽CTRL+ALT+DEL
            /// </summary>
            /// <param name="i">1=屏蔽 0=取消屏蔽</param>
            public static void ShieldMissionTask(int i)
            {
                try
                {
                    //屏蔽 Ctrl + Alt + Del 键
                    RegistryKey key = Registry.CurrentUser;
                    RegistryKey key1 = key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
                    key1.SetValue("DisableTaskMgr", i, Microsoft.Win32.RegistryValueKind.DWord);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }        /**/
            /// <summary>
            /// 是否显示任务栏
            /// </summary>
            /// <param name="i">5=显示 0=隐藏</param>
            public static void ShieldTaskBar(int i)
            {
                try
                {
                    IntPtr hTray = FindWindowA("Shell_TrayWnd", String.Empty); //获取任务栏
                    ShowWindow(hTray, i);    //隐藏任务栏
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }