-
通过注册表来控制系统键[原创]
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Microsoft.Win32;
5using System.Windows.Forms;
6
7
8namespace 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
-
相关阅读:
Problem 3
Problem 2
Problem 1
Python基础 装饰器
算法——狄克斯特拉算法
A Knight's Journey POJ 2488
多校10 1007 CRB and Queries
多校9 1007 Travelling Salesman Problem
多校8 1008 Clock
多校7 1005 The shortest problem
-
原文地址:https://www.cnblogs.com/winnxm/p/927818.html
Copyright © 2020-2023
润新知