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
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