title: How to convert a virtual-key code to a character according to the current keyboard layout?
body: <p>I have browsed several earlier questions about this, and the best answer I found so far is something like this:</p>
  
  <pre><code>(char) WinAPI.MapVirtualKey((uint) Keys.A, 2)
  </code></pre>
  
  <p>However, this doesn't work in two ways:</p>
  
  <ul>
  <li><p>It always returns capital letters. For <code>Keys.A</code> I expect to get the character <code>a</code>, while for <code>Keys.A | Keys.ShiftKey</code> I expect to get <code>A</code>; however, I seem to get <code>A</code> for both.</p></li>
  <li><p>It doesn't seem to take keyboard layouts into account. For example, for <code>Keys.OemMinus</code> I always seem to get the character <code>-</code>, even if the current keyboard layout is German, where I expect this key to return <code>ß</code>.</p></li>
  </ul>
  
  <p>What is the correct solution for this?</p>