The ToAscii function translates the specified virtual-key code and keyboard state to the corresponding Windows character or characters. The function translates the code using the input language and physical keyboard layout identified by the given keyboard layout handle.
int ToAscii(
UINT uVirtKey, |
// virtual-key code |
UINT uScanCode, |
// scan code |
PBYTE lpKeyState, |
// address of key-state array |
LPWORD lpChar, |
// buffer for translated key |
UINT uFlags |
// active-menu flag |
); |
The low bit, if set, indicates that the key is toggled on. In this function,
only the toggle bit of the Caps Lock key is relevant. The toggle state of the
Num Lock and Scroll Lock keys is ignored.
If the specified key is a dead key, the return value is negative. Otherwise, it is one of the following values:
Value |
Meaning |
0 |
The specified virtual key has no translation for the current state of the keyboard. |
1 |
One Windows character was copied to the buffer. |
2 |
Two characters were copied to the buffer. This usually happens when a dead-key character (accent or diacritic) stored in the keyboard layout cannot be composed with the specified virtual key to form a single character. |
The parameters supplied to the ToAscii function might not be sufficient to translate the virtual-key code, because a previous dead key is stored in the keyboard layout.
Typically, ToAscii performs the translation based on the virtual-key code. In some cases, however, bit 15 of the uScanCode parameter may be used to distinguish between a key press and a key release. The scan code is used for translating ALT+number key combinations.
Although Num Lock is a toggle key that affects keyboard behavior, ToAscii ignores the toggle setting (the low bit) of lpKeyState (VK_NUMLOCK, because the uVirtKey parameter alone is sufficient to distinguish the cursor movement keys (VK_HOME, VK_INSERT, and so on) from the numeric keys (VK_DECIMAL, VK_NUMPAD0 - VK_NUMPAD9).
OemKeyScan, ToUnicode, VkKeyScan
file: /Techref/os/win/api/win32/func/src/f88_9.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/11 16:37,
3.238.202.29: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://www.piclist.com/techref/os/win/api/win32/func/src/f88_9.htm"> ToAscii</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to www.piclist.com! |
.