System-wide keyboard Hook

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.

See also  5 Tips for Working With an Onsite Interpreter

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist