windows 使用 c# 以编程方式禁用任务管理器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2971097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Programmatically disabling Taskmanager using c#
提问by Anuya
I am working on a Kiosk application, I need to disable the taskmanager. So that when the user press [Ctrl + Alt + Del] and [Ctrl + Shift + Escape], the taskmanager should not pop up. How?
我正在开发 Kiosk 应用程序,我需要禁用任务管理器。这样当用户按下 [Ctrl + Alt + Del] 和 [Ctrl + Shift + Escape] 时,任务管理器不应弹出。如何?
回答by Samuel Neff
You can do it by changing the group policy settings.
您可以通过更改组策略设置来实现。
public void KillCtrlAltDelete()
{
RegistryKey regkey;
string keyValueInt = "1";
string subKey = "Software\Microsoft\Windows\CurrentVersion\Policies\System";
try
{
regkey = Registry.CurrentUser.CreateSubKey(subKey);
regkey.SetValue("DisableTaskMgr", keyValueInt);
regkey.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
回答by fmark
Just set the appropriate registry key:
只需设置适当的注册表项:
public void SetRegistryKey(Microsoft.Win32.RegistryKey regHive, string regKey, string regName, string regValue)
{
bool response = false;
Microsoft.Win32.RegistryKey key = regHive.OpenSubKey(regKey);
if (key == null)
{
regHive.CreateSubKey(regKey, Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree);
}
key = regHive.OpenSubKey(regKey,true);
key.SetValue(regName, (string)regValue);
}
SetRegistryKey(RegistryHive.CurrentUser, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", 1)