通过注册表来控制系统键[原创]

 

 1 using  System;
 2 using  System.Collections.Generic;
 3 using  System.Text;
 4 using  Microsoft.Win32;
 5 using  System.Windows.Forms;
 6
 7
 8 namespace  BOM.NewUI.Functions
 9 {
10    /**//// <summary>
11    /// 系统键控制
12    /// CONTROL + ALT + DELETE
13    /// </summary>

14    public class SystemKeyControl
15    {
16        启用系统键#region 启用系统键
17        /**//// <summary>
18        /// 项目启动时
19        /// 禁用CTRL+ALT+DELETE 
20        /// </summary>
21        /// 

22        public static void StopSystemKeys()
23        {
24            RegistryKey r = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies"true);
25            r.CreateSubKey("System");
26            r.Close();
27            RegistryKey s = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System"true);
28            s.SetValue("DisableTaskMgr"1);
29            s.Close();
30        }

31
32        #endregion

33
34        停用系统键#region  停用系统键
35
36        /**//// <summary>
37        /// 项目关闭时
38        /// 启用CTRL+ALT+DELETE
39        /// </summary>

40        public static void UseSystemKeys()
41        {
42            try
43            {
44                RegistryKey r = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System"true);
45                r.DeleteValue("DisableTaskMgr"true);
46                r.Close();
47            }

48            catch
49            {
50                MessageBox.Show("CTRL+ALT+DELETE可以正常使用!""提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
51            }

52        }

53
54        #endregion

55    }

56}

57

转载于:https://www.cnblogs.com/winnxm/archive/2007/10/17/927818.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值