 |
ToAscii ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
Translates the specified virtual-key code and keyboard state to the corresponding character or characters. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
int WINAPI ToAscii(
__in UINT uVirtKey,
__in UINT uScanCode,
__in_opt const BYTE *lpKeyState,
__out LPWORD lpChar,
__in UINT uFlags
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER ToAscii IN user32;
LONG uVirtKey,;
LONG uScanCode,;
STRING @lpKeyState,;
INTEGER @lpChar,;
LONG uFlags
|
 |
 |
 |
| Parameters: |
 |
uVirtKey [in]
The virtual-key code to be translated. See Virtual-Key Codes.
uScanCode [in]
The hardware scan code of the key to be translated. The high-order bit of this value is set if the key is up (not pressed).
lpKeyState [in, optional]
A pointer to a 256-byte array that contains the current keyboard state.
lpChar [out]
The buffer that receives the translated character or characters.
uFlags [in]
This parameter must be 1 if a menu is active, or 0 otherwise. |
 |
 |
| Return value: |
 |
| If the specified key is a dead key, the return value is negative. Otherwise, it is the number of charachters copied to the buffer, from 0 to 2. |
 |
 |
| Usage: |
 |
FUNCTION VKeyToASCII(nVirtKey As Number) As Number
LOCAL cKeyboardState, nAsciiCode
cKeyboardState = REPLICATE(CHR(0), 256)
GetKeyboardState( @cKeyboardState )
nAsciiCode=0
ToAscii( m.nVirtKey, MapVirtualKey(m.nVirtKey, 0),;
@cKeyboardState, @nAsciiCode, 0)
RETURN m.nAsciiCode
|
 |
 |
| My comment: |
 |
The function translates the code using the input language and physical keyboard layout identified by the keyboard layout handle.
To specify a handle to the keyboard layout to use to translate the specified code, use the ToAsciiEx function.
See also: MapVirtualKey, GetKeyboardState |
 |
 |
| Word Index links for the ToAscii : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2011-01-05 12:36:35 | | Modified: | 2011-01-05 12:41:43 | Visited in last 7 days: 24 |