1 year ago
#293157
James L
C# Transfer Keycode to Keychar
I know this issue is caused by using "Keydown-Keycode" and not "Keypress-Keychar" but how would I get my Keydown to use Keychar instead? Any thoughts. Im using a global keyboard hook and the hook only seems to use KeyUp and KeyDown. If you know how I can get a global hook to use KeyPress that would be awesome
private string b = string.Empty;
public void gkhr_KeyDown(object sender, KeyEventArgs e)
{
s += (char)e.KeyCode;
b = s; // i made b = s because otherwise it would add two values together
b = b.ToLower(); // Was able to use A-Z in lowercase here
s = string.Empty; // cheeky little hack
MessageBox.Show(b);
When I click on keyboard "," it displays "3/4". Another example being "F1" prints "q"
Link [1]: https://i.stack.imgur.com/LiQ9e.png
c#
hook
keypress
keydown
keyup
0 Answers
Your Answer