The
ToUnicode function translates the specified virtual-key code and keyboard state to the corresponding Unicode character or characters.
Function Information Minimum DLL Version user32.dll
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows NT 3.1 I am still unsure why exactly it is called a dead key, as it just sounds like some sort of shift key)
The shift, control and alt keys are pressed at the same time the letter key is pressed. To generate an upper case E you press both VK_SHIFT and VK_E. Dead keys are more complex than this.
There are two types of dead keys. A simple dead key is a keyboard key that is pressed down and then released, followed by the regular letter. To generate the letter
? I press the key to the right of the P, release it, and then press the VK_E key. To generate the uppercase letter
? I press the key to the right of the P, release it, and then press both the VK_SHIFT and the VK_E keys.
A complex dead key involves pressing down the right alt key and another key, releasing them, and then pressing a regular letter. To generate the letter
? I press the alt-gr (the right alt) key followed by the key to the right of the P, release both these keys, and then press the VK_E key. To generate the uppercase letter
? I press the alt-gr (the right alt) key followed by the key to the right of the P, release both these keys, and then press both the VK_SHIFT and the VK_E keys.
On my current keyboard I can also press the apostrophe key (two keys to the right of the letter L) to directly create a
?, and VK_SHIFT followed by this "apostrophe" to create an uppercase
?. The next key to the right (third to the right of the letter L) is mapped to the
? and when VK_SHIFT is down I generate the uppercase
?. These "shortcuts" exist because these two letters
? and
? are very common but
? is not and so it requires the alt-gr + key to the right of the P, release both, and then press the VK_U key.
Reproducing these scenarios through DirectInput would require some work. Trapping a WM_CHAR simplifies this greatly; you receive the end result of the work done by TranslateMessage().