禁用某些键 [英] Disable certain keys

查看:75
本文介绍了禁用某些键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以禁止用户在程序执行过程中执行某些键?我不希望他们执行"CTRL ALT DELETE" ..我希望他们完成我程序的过程,然后能够存在,而不是在过程中.另外,像"messagebox.show(您不能按Ctrl + alt + delete")一样; ...谢谢!

I was wondering is it possible to disallow a user to perform certain keys during the program? I dont want them to do " CTRL ALT DELETE " .. I wish them to finish the processes of my program and then be able to exist, not during. Also, have like a "messagebox.show("You can't press Ctrl+alt+delete"); ... Thanks!

推荐答案

实际上并不是那么容易.这里有一篇很好的文章阻止用户使用taskmanager杀死应用程序的最简单方法是使用系统策略将其禁用.您可以通过将以下注册表项设置为1来做到这一点(如果不存在,只需创建它即可)

The easiest way to prevent user from using the taskmanager to kill your application, is disable it using system policies. You can do this by setting the following registry key to 1 (if it doesn't exist, just create it)

HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \
策略\ System \ DisableTaskMgr:DWORD

HKCU\Software\Microsoft\Windows\CurrentVersion\
  Policies\System\DisableTaskMgr:DWORD

您可以在应用程序启动时进行设置,并在应用程序退出时将其重置(如果已全部打开,请不要在退出时将其关闭)缺点是,如果您的应用程序崩溃,该策略将不会重置.

You can set this as your application starts and reset it when your application exits (if it was allready turned on, don't turn it off on exit ) The drawback is, that if your application crashes, the policy won't get reset.

如果您真的想要完全控制,可以使用本文中介绍的注入技术.它只有几行代码(它们在c中,但是很容易理解并转换为c#)

If your really want full control, you can use the injection technique described in the article.It's only a few lines of code (they are in c, but can easily be understanded and translated into c#)

希望这会有所帮助,


这篇关于禁用某些键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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