禁用键盘和鼠标 [英] disable the keyboard and mouse

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

问题描述

我想用一个热键(如ALT-D)禁用键盘和鼠标,并用另一个热键(也如ALT-E)启用它...请帮助

i want to disable the keyborad and mouse with one hot key (like ALT-D) and enable it back with another hot key(also like ALT-E)...please help

推荐答案

如果禁用了键盘和鼠标,那么如何期望通过键盘按键或鼠标单击来重新启用?
If you disable the keyboard and mouse, how do you expect to RE-enable with a keyboard key press or a mouse click?


(C ++/MFC解决方案但适用于其他工具包)

(未经测试,也未经验证,只是作为讨论的基础)
您可以覆盖PreTranslateMessage(或类似的东西)并检查按键,当用户输入alt-d时您将其记录下来(保存状态boolean),并且当布尔值为true时,只需跳过除alt-e之外的所有按键即可. ..

对于鼠标,可能有一些处理方法,但是我没有任何线索.

IMO,封锁键盘和鼠标是个坏主意.
(C++/MFC solution but applicable to other toolkits )

(not tested, nor verified, just as a base for discussion)
You could override PreTranslateMessage (or something similar) and check the key-press and when user enters alt-d you log it (save a state boolean) and when the boolean is true, just skip all the key-press except alt-e...

For the mouse, there might be something to do about it, but I''ve got no clue.

IMO, it''s a bad idea to block the keyboard and mouse.


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

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