Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: NT
Expertise: Beginner
Oct 21, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

System-wide keyboard Hook

I want to trap the special keys of Windows NT: Alt+Tab, Ctl+Alt+Del. In the first 10 minutes, I set a kbd hook and took a look at what were the keys I received. But the handling for these special keys takes place before even a WM_KEYDOWN is generated. So what must I do to trap the spl keys? Do I need to install a custom-built keyboard driver? Or is there some 10-minute workaround I am missing? Thanks and keep up the good work, Shriram

I have bad news for you. You CANNOT trap Ctrl-Alt-Del on NT—no way, no time, no how. This is at the core of the NT security system, and there is no combination of API calls that will allow you to trap this. You could write a new security provider (NT allows this, so vendors can use things like smart cards and fingerprints to logon), but that is a totally nontrivial task. You can, however, trap Alt-Tab with a keyboard hook. If you are working with VB, you can use SpyWorks from Desaware to trap messages like Ctrl-Esc, Alt-Tab, and Alt-Esc. (It even comes with an example program that disables all three of the key combinations above.) If you are working with C++, see the section in MSDN on SysMsgProc.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date