Intercept keystrokes

How can I write a program that runs in
the background and intercepts
keystrokes?

Is there some MFC that does this for me?

What I want to do is be able to remap
keystrokes so I can duplicate the program
found at http://www.halfkeyboard.com/

for example I could press the letter f
and the spacebar at the time and the
program would intercept that and pass
along a j.

Thanks!
Bill Blair



wblair8689Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mcriderConnect With a Mentor Commented:
Remember to unhook the keyboard handler when you use the example in build mode...

VB will crash if you stop it and the key handler is still active...

Cheers!
0
 
Erick37Commented:
You need to install a system hook to intercept all keyboard messages for all windows on a system.  VB cannot do this alone, you need a hook proc located in a standard DLL.  The following site contains information on how to do this along with supporting DLLs:

http://vbaccelerator.com/codelib/hook/vbalhook.htm
0
 
wblair8689Author Commented:
A link to another site isn't really an answer - although the link was helpful.
0
 
mcriderCommented:
This MICROSOFT KB article has a complete example of intercepting keys...

HOWTO: Intercept Keyboard Input from Visual Basic
http://support.microsoft.com/support/kb/articles/Q177/9/92.ASP


Cheers!
0
 
wblair8689Author Commented:
It looks like vb can not do this. It is not able to create system dll's to capture system events.
0
All Courses

From novice to tech pro — start learning today.