简体   繁体   English

(C ++)在Windows中禁用Alt命令

[英](C++) Disabling Alt commands in Windows

I'm making a program that needs to block all input during a short critical section. 我正在编写一个程序,该程序需要在关键的短时间内阻止所有输入。 I used BlockInput, but it still allows the user to use hotkeys like Ctrl+Alt+F1 or Ctrl+Alt+F2 (switching taskbar in both displays). 我使用了BlockInput,但它仍然允许用户使用Ctrl + Alt + F1或Ctrl + Alt + F2之类的热键(在两个屏幕上切换任务栏)。 It is crucial that the user is not able to use these two hotkeys. 用户不能使用这两个热键至关重要。

I read some things about a hook, but I'm not sure where to start with this solution. 我读了一些有关钩子的内容,但是我不确定从哪里开始使用该解决方案。 Any help would be greatly appreciated. 任何帮助将不胜感激。

Thanks! 谢谢!

A keyboard hook could do the trick - check out SetWindowsHookEx . 键盘挂钩可以解决问题-检出SetWindowsHookEx Note that it gets tricky on 64-bit systems. 请注意,在64位系统上,它变得棘手。

But may I suggest simply setting your process/thread priority to some ludicrously high value? 但是我是否建议您简单地将您的进程/线程优先级设置为一个可笑的高值? Windows will really favor your process then, and at the highest settings even keyboard and mouse stopped working - I found that out the hard way. 那时Windows确实会支持您的过程,并且在最高设置下,甚至键盘和鼠标也无法工作-我发现这很困难。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM