Hi,

Is there a way to modify the keyboard output? For example, I would like change the
"a" character to "b" when the user presses the key and my application is running.

I'm using a keyboard hook class, it can be found at
http://www.codeproject.com/csharp/globalhook.asp?msg=1033410. However, I haven't
found a way to change the output. I've searched the net for this but I've found
nothing usable. Do you have any idea how could this be accomplished (I know it's
possible since I saw other applications doing it)?

Thanks,

Radu Stanciu

Re: Trap and modify input using a keyboard hook by Jakob

Jakob
Mon Feb 21 12:46:25 CST 2005

This is one way I can think of doing it:

private void textBox1_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == char.Parse("a"))
e.KeyChar = char.Parse("b");
}

Of course you should provide a more intelligent way of determining the
key pressed and the replacement to use, but hopefully the example shows
the idea.

Hope it helps,
Jakob

Radu Stanciu wrote:

> Hi,
>
> Is there a way to modify the keyboard output? For example, I would
> like change the "a" character to "b" when the user presses the key and
> my application is running.
>
> I'm using a keyboard hook class, it can be found at
> http://www.codeproject.com/csharp/globalhook.asp?msg=1033410. However,
> I haven't found a way to change the output. I've searched the net for
> this but I've found nothing usable. Do you have any idea how could
> this be accomplished (I know it's possible since I saw other
> applications doing it)?
>
> Thanks,
>
> Radu Stanciu