部分打开/关闭输入设备 [英] Turn Input Devices Partially ON/OFF

查看:119
本文介绍了部分打开/关闭输入设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

有没有一种方法可以在除一个键之类的按键按下事件时关闭输入设备(键盘/鼠标),例如(我按下"F11",所有鼠标和键盘键都被禁用,但"F10"除外),我习惯重新打开它们.

等待您的想法,
问候,
Safi

Hello,

Is there like a way that I can turn Input devices (Keyboard/Mouse) OFF on a keydown event excluding one Key like for example (I hit "F11", all Mouse & keyboard keys are disabled excluding "F10", which I use to turn them all back on.

Awaiting your Ideas,
Regards,
Safi

推荐答案

这绝对是不可能的,例如,因为没有办法禁用Ctrl + Alt + Delete -系统不会让它无所事事你做什么.

我不确定是否可以全局禁用其他任何功能,但是您不应该尝试破坏操作系统.整个想法不好.

不幸的是,您没有分享您的最终目的.您应该始终从它开始.因此,很难提供其他建议,但是也许您想要的是信息亭模式"?请参阅:
使用C#以Kiosk模式运行网站 [ c#程序ctrl-alt-del屏幕窗口7 [ ^ ].

—SA
This is absolutely impossible, for example, because there is no a way to disable Ctrl+Alt+Delete — the system won''t let it no matter what you do.

I''m not sure that global disable of anything else is possible, but you should not try to disrupt OS that much. The whole idea is bad.

Unfortunately, you did not share you ultimate purpose. You should always start with it. So, it''s hard to advise anything else, but maybe what you want is the "Kiosk mode"? Please see:
Running a Web Site in Kiosk Mode with C#[^],
c# program ctrl-alt-del screen windows 7[^].

—SA


萨菲,

假设您仅尝试对应用程序执行此操作,为什么不在代码中仅添加AcceptInput之类的布尔值.然后,检测F11键并将AcceptInput设置为false.如果您检测到F10键,请将其设置为true.最后,将所有其他键盘/鼠标输入处理代码包装在if块中,以测试AcceptInput是否为true.如果是,请按正常方式处理输入,否则请忽略.

但是,如果您尝试阻止所有应用程序的所有输入,那么我不确定是否有可能,至少我当然希望不是这样!

希望这会有所帮助,
Ed
Hi Safi,

Assuming that you are trying to do this for your application only, why not just have a bool in your code that is something like AcceptInput. Then, detect the F11 key and set AcceptInput to false. If you detect the F10 key, set it to true. Finally, wrap all your other keyboard/mouse input handling code in an if block that tests whether AcceptInput is true. If it is, handle the input as normal, if it isn''t, just move ignore.

If, however, you are trying to block all inputs for all applications, then I''m not sure that it is even possible, at least I certainly hope it isn''t!

Hope this helps,
Ed


这些都不是我想要的解决方案,我希望全局锁定我的键盘键,我有一个GlobalHook监听我的击键,并且我想制作一个( IF)块在某个keyUp事件发生时激活,并在另一个keyUp事件发生时停用,这确实很重要,我向您保证我不会滥用这些知识,我敢肯定可能,只是不记得方法了.

谢谢!
萨菲
None of these are the solution I seek, I wish to lock my keyboard keys globally, I have a GlobalHook that listens to my keystrokes, and I want to make a (IF) block that activates when a certain keyUp event happens, and deactivate when another keyUp event accords, it''s really important, and I assure you I''m not gonna abuse such knowledge, I''m sure it''s possible, just cannot remember the method.

Thank you!
Safi


这篇关于部分打开/关闭输入设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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