Click here to Skip to main content
15,942,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm using SetWindowHookEx with WH_KEYBOARD_LL to hook keys on keyboard. I try to hook Ctrl + Alt + Delete with:

if (GetAsyncKeyState(VK_CONTROL) && (GetAsyncKeyState(VK_MENU) && (p->vkCode == VK_DELETE))

But it doesn't work!

So, how to catch event Ctrl+Alt+Delete with Hook?

Thank you

1 solution

To best of my knowledge, you cannot do it.

This is not possible, anyway, not on the user mode. This keyboard combination is treated in a special way by the OS. When you press Delete, and Ctrl and Alt are pressed, the keyboard event does not dispatched to any of the application programs at all. I think intercepting that could only be possible on the kernel level, if possible at all.

Such design feature of OS is quite explainable. For example, lust imaging that Ctrl+Alt+Delete can be caught by some application program which would hang or otherwise become defunct, effectively blocking access to Task Manager, switching user, etc. This would be too unsafe to allow to happen.

Share this answer
SVPro 18-Apr-12 5:00am    
Hi SAKryukov,

Thank you, so how do we hook Alt + other keys (A, B, C, D, E.....)
I'm successful with Ctrl + others keys (A, B, C...) but NOT with Alt + others key.

And hook up to 3 keys combination, 4 keys combination......
Thank you
Sergey Alexandrovich Kryukov 19-Apr-12 0:14am    
I don't see the difference, if you are using SetWindowsHookEx.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900