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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
mcriderCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wblair8689Author Commented:
It looks like vb can not do this. It is not able to create system dll's to capture system events.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.