I have browsed several earlier questions about this, and the best answer I found so far is something like this:
(char) WinAPI.MapVirtualKey((uint) Keys.A, 2)
However, this doesn't work in two ways:
It always returns capital letters. For
Keys.AI expect to get the charactera, while forKeys.A | Keys.ShiftKeyI expect to getA; however, I seem to getAfor both.It doesn't seem to take keyboard layouts into account. For example, for
Keys.OemMinusI always seem to get the character-, even if the current keyboard layout is German, where I expect this key to returnß.
What is the correct solution for this?