如何使用C#和wpf禁用ctrl + Alt + del和windows buttton? [英] how to disable ctrl+Alt+del and windows buttton using C# with wpf ?

查看:280
本文介绍了如何使用C#和wpf禁用ctrl + Alt + del和windows buttton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要禁用ctrl + Alt + del和windows buttton使用C#和wpf



我的程序将记录Windows 7和Windows 8.

I am tring to disable ctrl+Alt+del and windows buttton using C# with wpf

my program will traget Windows 7 and windows 8 .

推荐答案

其他解决方案中的代码仅禁用TaskManager。它不会禁用Ctrl-Alt-Del。不能禁用该组合键。



只能通过编写全局键盘钩子来禁用Window键,并且只能在代码中将该键传递到挂钩链上看到它。



另外,如果你试图阻止人们停止进程,那么解决方案1中给出的注册表黑客只会阻止TaskManager运行。它不会阻止其他实用程序被用来做同样的事情,比如TaskList和TaskKill。
The code in the other solution only disables TaskManager. It does NOT disable Ctrl-Alt-Del. That key combination can NOT be disabled.

The Window key can only be disabled by writing a global keyboard hook and just not passing that key up the hook chain when your code sees it.

Also, if you're trying to stop people from stopping processes, the registry hack you were given in Solution 1 only prevent TaskManager from running. It will not stop other utilities from being used to do the exact same thing, like TaskList and TaskKill.


请检查下面的链接。它可能会对你有帮助。



如何禁用CTRL + ALT + DEL键



另一个链接:可以禁用Control-Alt-Delete按钮



这是c#代码



Please check below link.It may be helped to you.

How to Disable CTRL+ALT+DEL Key

Another Link : Possible to disable Control-Alt-Delete buttons

Here is the c# code

private void DisableTaskManager()
{
    RegistryKey regkey = default(RegistryKey);
    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) {
        Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "Registry Error!");
    }

}










private void EnableTaskManager()
{
    RegistryKey regkey = default(RegistryKey);
    string keyValueInt = "0";
    //0x00000000 (0)
    string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";
    try {
        regkey = Registry.CurrentUser.CreateSubKey(subKey);
        regkey.SetValue("DisableTaskMgr", keyValueInt);
        regkey.Close();
    } catch (Exception ex) {
        Interaction.MsgBox(ex.Message, MsgBoxStyle.Critical, "Registry Error!");
    }

}





您可以使用此免费工具进行转换: 将VB.NET转换为C#


这篇关于如何使用C#和wpf禁用ctrl + Alt + del和windows buttton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆