Thursday, February 23, 2012 1:30 AM
Is there an equivalent of MapVirtualKey in WinRT API? I want to convert a virtual key coming in through KeyDown into the equivalent character.
Thursday, February 23, 2012 7:51 AMModerator
There isn't a direct equivalent. What exactly are you trying to do? MapVirtualKey has several different uses some of which may be achievable in other ways.
Thursday, February 23, 2012 6:23 PM
I'll describe my use case in the old windows API:
- using a Finnish keyboard layout, I type ä (it is on the key where a US keyboard has a ')
- I receive a window message WM_KEYDOWN with uParam 222
- I pass 222 to MapVirtualKey: UINT character = ::MapVirtualKeyW(222, MAPVK_VK_TO_CHAR);
Result: character == 228 (a.k.a. ä)
If I was using a keyboard with US layout, calling MapVirtualKeyW with 222 would result in character==39 (a.k.a. ')
- Edited by Jani L Thursday, February 23, 2012 6:23 PM
Friday, March 09, 2012 2:49 PM
An answer to Jani's question would be incredibly useful. MapVirtualKey is needed to translate KeyDown event arguments to characters, which currently is a must in Windows RT, because the CharacterReceived event doesn't exist anywhere except on the CoreWindow, and it is called *after* the KeyDown event in the TextBox that will actually process the key.
- Edited by Ludvig A Norin Friday, March 09, 2012 3:03 PM