Link to home
Start Free TrialLog in
Avatar of vcl
vcl

asked on

How to trap Alt+Tab & Ctrl+Esc keypress

Hello,

I'm writing a Vision Software where I don't want the user to accidentally press the system keys (ie: alt+tab & 
ctrl+esc). How do I go about trapping these messages?

I'm writing my software in Microsoft's Visual C++ 5.0 targeted for Window's NT platform. I tried to enter the above keypresses in the accelerator table and use the TranslateAccelerator API but somehow, these keypress messages never get trapped.


Please Help.


Thank You
Vivien A.
Avatar of kburns102197
kburns102197

The method & functions necessary to trap these keys is dependent on the development language.    What language are you writing in?
Avatar of vcl

ASKER

Edited text of question
I've been watching this question intently, because it is a problem I've been having to.  The fact you haven't gotten an answer is discouraging, it looks like there almost isn't away.  
One thing that makes this hard to do (as you may already know) is that windows does not pass the regular keydown, keyup, and character messages for these keys.  In fact, it appears to me that it sends no messages at all for these keys.  That seems a little unfair.  If this is true, then a message processing solution is out.  An approach that might work (I haven't tried) would be to use a hook.  It is possible to hook the keyboard with SetWindowsHookEx() using WH_KEYBOARD.

I have no experience in this area, so I'm not sure that the restrictions, if any, are.  But you might have the hook routine look for the keys and, if found, send a message, to your application.  This of course requires that the hook routine get notified for these keys.  I don't know if it is.

If you try this, I'd like to know what you find.
Surely you can't do it without writing driver which intercepts these keystrokes. Setting hooks doesn't help, I've worked on the same problems a couple of years ago and had not found any simple solution. Try to search WEB for the driver.
What is the problem with hooks?  Is it that you don't get notification for these two keys?
No, you get notification on ALT as syskey. But when you press ALT-TAB - oops - you got nothing. Impossible to prevent the switching itself. I forgot many details, so dont ask me any details - I can get wrong :).
ASKER CERTIFIED SOLUTION
Avatar of alexo
alexo
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial