//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 ; Move "" To sBuff Else ; Move (Cstring(sBuff)) To sBuff Function_Return sBuff End_Function