Everyone knows that the combinations of the alt kbd>+ f4 kbd>completes the program, or rather turns off the first window, and the KBD key combinations are Ctrl kbd>+ Alt kbd>+ Del kbd>Calls Task Manager.
Is it possible to write code that when you running the program, did not react to these combinations of the keys, well, or issued messages in messenger boxing?
Answer 1, Authority 100%
alt kbd>+ f4 kbd>only Sends the window message WM_CLOSE
. The program can respond to this message closing window, and may not react.
ctrl kbd>+ alt kbd>+ del kbd>is processed by the system and applications not sent. In order to intervene in his work, you will have, I'm afraid to descend the keyboard driver level.
about Ctrl + Alt + Del, here is the translation of Answer with ServerFault :
Windows kernel (NT) is designed in this way: it reserves an alert about this key combination only for the WinLogon system process. Thus, if Windows works correctly, no user application can process this key combination. If it could, it would be able to show the user a fake screen login and thus intercept his password;)
Here is This article says that
Slim out CTRL-ALT-DEL sequence using
SendKeys
will not work. Pressing Ctrl-Alt-Del causes a hardware interrupt, through a straight separate key on the keyboard.
That is, it will not be possible to intercept it.
accept.
Answer 2, Authority 17%
I will not say about alt kbd>+ f4 kbd>, but on ctrl kbd>+ alt kbd>+ del kbd>Put a hook, as far as I know, it is impossible, and, accordingly, you cannot attach any actions.
p.s. In any case, it's not all done on C #, only si, only hardcore.
Answer 3
Interception ALT kbd>+ F4 kbd>:
public form1 ()
{
Initializecomponent ();
this.KeyPreView = True;
}
PROTECTED OVERRIDE VOID OnKeydown (Keyeventargs E)
{
Base.ONKEYDOWN (E);
if (E.KEYCode == Keys.f4 & amp; & amp; e.alt)
{
MessageBox.Show ("Test");
E.HandLed = True;
}
}