Link to home
Start Free TrialLog in
Avatar of wblair8689
wblair8689

asked on

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



Avatar of Erick37
Erick37
Flag of United States of America image

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
Avatar of wblair8689
wblair8689

ASKER

A link to another site isn't really an answer - although the link was helpful.
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!
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

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
It looks like vb can not do this. It is not able to create system dll's to capture system events.