//TH-Header //***************************************************************************************** // Copyright (c) 2001 Michael Kurz // All rights reserved. // If you want to use this source in your applications conatct: // // $FileName : mWinAPIGetKeyNameText.pkg // $ProjectName : Shared Methods // $Author : Michael Kurz // $Created : 01.05.2001 20:02 // // Contents: // -WinAPIGetKeyNameText integer iVirtualKeyCode returns string // // Gets the name of a VK key code. //***************************************************************************************** //TH-RevisionStart //TH-RevisionEnd #IFNDEF GET_MAPVIRTUALKEY External_Function MapVirtualKey "MapVirtualKeyA" User32.dll Integer iVK Integer iMode Returns Integer #ENDIF external_function GetKeyNameText "GetKeyNameTextA" User32.dll Integer iKey Pointer pBuff Integer iSize Returns Integer // Retrieves the name of a key. (Virtual KeyCode) Function WinAPIGetKeyNameText Global Integer iKey Returns String Integer iRet Local_Buffer sBuff pBuff 1024 Move (MapVirtualKey(iKey,0)) To iKey Move (iKey*65536) To iKey Move (GetKeyNameText(iKey,pBuff,1024)) To iRet If iRet Eq 0 Function_Return "" Else Function_Return (Cstring(sBuff)) End_Function