A friend of mine is blind and I've got an idea of developing a program that would let him use a PC with the help of a blind typing method and audial feedback. The experience would be much richer (making use of more keys for particular functions) and flawless (like preventing occasional focus loss) if my application could forcibly take total control over the whole keyboard input as soon as it is started (I'd put it in start-up for him). I am a WinForms C# .Net developer so I'd like to implement this in an application using this particular framework and language (don't mind wrapped WinAPI calls though).
PS: I don't mind the system keeping control over the Ctrl+Ald+Del combination, but I'd like to take control over all the other keys and combinations, including the Windows logo and standard application launcher buttons.
You can use the low-level keyboard hook implementation posted here. It shouldn't steal focus away from any programs but your program can be notified when keys are pressed. This is the code from the post in case the link stops working.
You can handle the key presses in the
HookCallback
event (or further abstract the main parts into a separate class and raise an event).I know this topic is old, but I found a possible solution. You can use the last answer and edit it a little bit:
instead of calling the next hook
just return -1 for stopping proceding any handle to other controls
This isn't nice but it's working. Be careful with this!