使用 C# 以编程方式禁用任务管理器

发布于 2024-09-03 18:54:56 字数 99 浏览 4 评论 0原文

我正在开发 Kiosk 应用程序,我需要禁用任务管理器。这样当用户按[Ctrl + Alt + Del]和[Ctrl + Shift + Escape]时,任务管理器不应该弹出。如何?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

〆凄凉。 2024-09-10 18:54:56

您可以通过更改组策略设置来做到这一点。

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());
    }
}

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());
    }
}
忆依然 2024-09-10 18:54:56

只需设置适当的注册表项:

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)

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)
叶落知秋 2024-09-10 18:54:56

以管理员身份运行命令提示符。
禁用任务管理器:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f

启用任务管理器:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System / v DisableTaskMgr /t REG_DWORD /d 0 /f

Run the Command Prompt as administrator.
Disable Task Manager:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f

Enable Task Manager:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 0 /f

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文