How can I detect Ctrl-Alt-Del either before or after the OS detects it?

廉价感情. 提交于 2020-01-15 05:01:12

问题


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?


回答1:


In short, you can't.




回答2:


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.



来源:https://stackoverflow.com/questions/2090930/how-can-i-detect-ctrl-alt-del-either-before-or-after-the-os-detects-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!