如何在操作系统检测到 Ctrl-Alt-Del 之前或之后检测到它?
当用户按 Ctrl-Alt-Del 时,我需要初始化变量。由于该组合键的处理方式与其他组合键不同,因此按下该组合键后会立即出现“Windows 安全”对话框,而我的程序无法检测到是否按下了该组合键。
我尝试将下面的代码添加到 KeyDown 事件中,但它不起作用。
if ( (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt)) && Keyboard.IsKeyDown(Key.Delete))
{
// Initialize a variable
}
如果可能的话,我怎样才能在操作系统检测到这个组合键之前检测到它?如果没有,操作系统后如何检测?
I need to initialize a variable when the user presses Ctrl-Alt-Del. Because this key combination is treated differently than others, the Windows Security Dialog Box appears immediately after it is pressed and my program can not detect whether it is pressed.
I tried adding the code below to the KeyDown event, but it does not work.
if ( (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt)) && Keyboard.IsKeyDown(Key.Delete))
{
// Initialize a variable
}
If it is possible, how can I detect this key combination before the OS detects it? If not, how can I detect it after the OS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,你不能。
In short, you can't.
即使可以,您也不应该,因为更改 Ctrl-Alt-Del 的含义会让用户感到困惑。
我希望如果不更换键盘驱动程序等就不可能做到这一点,否则应用程序可能会使用户无法访问任务管理器来终止该应用程序。
Even if you can, you should not, as changing the meaning of Ctrl-Alt-Del would confuse users.
I hope it is not possible to-do without replacing keyboard drivers etc, as otherwise an application could make it impossible for the user to get to the task manager to kill the application.