如何在操作系统检测到 Ctrl-Alt-Del 之前或之后检测到它?

发布于 2024-08-18 11:49:11 字数 429 浏览 1 评论 0原文

当用户按 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑忘罢 2024-08-25 11:49:11

简而言之,你不能。

In short, you can't.

究竟谁懂我的在乎 2024-08-25 11:49:11

即使可以,您也不应该,因为更改 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文