The ToUnicode function translates the specified virtual-key code and keyboard state to the corresponding Unicode character or characters.
int ToUnicode(
UINT wVirtKey, |
// virtual-key code |
UINT wScanCode, |
// scan code |
PBYTE lpKeyState, |
// address of key-state array |
LPWSTR pwszBuff, |
// buffer for translated key |
int cchBuff, |
// size of translated key buffer |
UINT wFlags |
// set of function-conditioning flags |
); |
The function returns one of the following values:
Value |
Meaning |
- 1 |
The specified virtual key is a dead-key character (accent or diacritic). This value is returned regardless of the keyboard layout, even if several characters have been typed and are stored in the keyboard state. If possible, even with Unicode keyboard layouts, the function has written a spacing version of the dead-key character to the buffer specified by pwszBuffer. For example, the function writes the character SPACING ACUTE (0x00B4), rather than the character NON_SPACING ACUTE (0x0301). |
0 |
The specified virtual key has no translation for the current state of the keyboard. Nothing was written to the buffer specified by pwszBuffer. |
1 |
One character was written to the buffer specified by pwszBuffer. |
2 or more |
Two or more characters were written to the buffer specified by pwszBuff. The most common cause for this is that a dead-key character (accent or diacritic) stored in the keyboard layout could not be combined with the specified virtual key to form a single character. |
The parameters supplied to the ToUnicode function might not be sufficient to translate the virtual-key code because a previous dead key is stored in the keyboard layout.
Typically, ToUnicode performs the translation based on the virtual-key code. In some cases, however, bit 15 of the wScanCode parameter can be used to distinguish between a key press and a key release.
file: /Techref/os/win/api/win32/func/src/f88_11.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/8 18:14,
18.220.116.195:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/os/win/api/win32/func/src/f88_11.htm"> ToUnicode</A> |
Did you find what you needed? |