A
Alex Maghen
Hi. I posted this question a LONG time ago, got a response from the wonderful
Linda Liu, and then lost the thread and everything but need to close up the
issue.
I need to be able to globally hook the keyboard in a C# Windows App, but,
very specifically, I need to be able to receive a KeyPress event that will
tell me the actual CHARACTER that was pressed in the keyboard's current
state, rather than the lower-level stuff (which keyboard key, shift up/down,
etc., etc.).
In other words, I want a KeyPress event that will provide me characters such
as:
x
X
a
A
פ - a unicode character when the keyboard is in a different language
×¢ - a unicode character when the keyboard is in a different language
p
P
.... you get the idea. Linda had sent me the really nice, clean sample at
http://www.codeproject.com/KB/cs/globalhook.aspx
which gives me a really nice KeyPress event very easily that will give me
the English KeyChar, already upper or lower case, as I want it. HOWEVER, if I
switch to a different language keyboard and press a key, the event raises
KeyPress with a KeyChar == '?'. I checked the numerical value, it actually
returns a 63 which is a question mark, '?' instead of the key in the other
keyboard.
I'm so close. Can someone let me know if there's a way for me to do this
based on this example at http://www.codeproject.com/KB/cs/globalhook.aspx
Much appreciated.
Alex
Linda Liu, and then lost the thread and everything but need to close up the
issue.
I need to be able to globally hook the keyboard in a C# Windows App, but,
very specifically, I need to be able to receive a KeyPress event that will
tell me the actual CHARACTER that was pressed in the keyboard's current
state, rather than the lower-level stuff (which keyboard key, shift up/down,
etc., etc.).
In other words, I want a KeyPress event that will provide me characters such
as:
x
X
a
A
פ - a unicode character when the keyboard is in a different language
×¢ - a unicode character when the keyboard is in a different language
p
P
.... you get the idea. Linda had sent me the really nice, clean sample at
http://www.codeproject.com/KB/cs/globalhook.aspx
which gives me a really nice KeyPress event very easily that will give me
the English KeyChar, already upper or lower case, as I want it. HOWEVER, if I
switch to a different language keyboard and press a key, the event raises
KeyPress with a KeyChar == '?'. I checked the numerical value, it actually
returns a 63 which is a question mark, '?' instead of the key in the other
keyboard.
I'm so close. Can someone let me know if there's a way for me to do this
based on this example at http://www.codeproject.com/KB/cs/globalhook.aspx
Much appreciated.
Alex