views:

168

answers:

3

hello!

is it possible to edit a keystroke using a winapi keyboard hook? well, not neccesary a keyboard hook but something like it..

i wanna do something like this:

user presses key 'A'

my function adds 1 to the virtual keycode (just an example)

the 'A' becomes an 'B'

and the 'B' is sent to the destination application

thanks!

+1  A: 

First, you need a Keyboardhook. You install a filter and the filter function receives the virtual-key code and the state of the keyboard at the time of the keyboard hook. Then you can change the virtual-key code.

Additional Links:

http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms644984(VS.85).aspx

Tobias Langner
if i understand you correct, i've already tried this. do you mean just to change the virtal code in the KBDLLHOOKSTRUCT received in the keyboardproc?
shuwo
from what i've read, that's what you need to do.
Tobias Langner
A: 

I think you can do it by eating up the keystroke entered by user by applying keyboard hook. and generating key_event of the character you want.

Ashish
A: 

See tool AutoHotkey, with source code available.

lsalamon