Using Win32 functions in Visual FoxPro Image Gallery
Keyboard Input
..msdn
ActivateKeyboardLayout
BlockInput
EnableWindow
GetActiveWindow
GetAsyncKeyState
GetFocus
GetKBCodePage
GetKeyboardLayout
GetKeyboardLayoutList
GetKeyboardLayoutName
GetKeyboardState
GetKeyNameText
GetKeyState
IsWindowEnabled
keybd_event
MapVirtualKey
RegisterHotKey
SetFocus
SetKeyboardState
ToAscii
UnregisterHotKey
VkKeyScan
Code examples:
Capturing keyboard activity of another application with the Raw Input API (VFP9)
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:
Capturing keyboard activity of another application with the Raw Input API (VFP9)
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:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2011-01-05 12:36:35
Modified: 2011-01-05 12:41:43
Visited in last 7 days: 70
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.166.199.178)
12 sec.Function: 'DrawFrameControl'
22 sec.
Function group: 'Shell Lightweight Utility APIs -- string functions'
33 sec.Function: 'CreateDC'
45 sec.Function: 'EnumForms'
59 sec.Function: 'GetPrintProcessorDirectory'
1.17 min.Function: 'GetTcpTable'
1.38 min.Function: 'CeGetSystemPowerStatusEx'
1.57 min.Function: 'GetPriorityClipboardFormat'
1.82 min.Function: 'WriteProcessMemory'
2.07 min.Function: 'GetStartupInfo'
Google
Advertise here!