Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
How to transform a string into a byte type ?
here is the code i use to set the Scancode Map value in the registry.
this code doesn't creat a byte type. But when i put the value directly in the registry it works well.
So why this code doen't give a byte type but a string type ?
***************
#DEFINE HKEY_LOCAL_MACHINE -2147483646 && BITSET(0,31)+2
#INCLUDE registry.h
oReg = NEWOBJECT("registry", "registry")
lc_Value = Str2Byte('00000000000000000300000000005BE000005CE000000000')
oReg.SetRegKey("Scancode Map",lc_Value,;
"System\CurrentControlSet\Control\Keyboard Layout",;
HKEY_LOCAL_MACHINE,.t.)
FUNCTION Str2Byte(tn_String)
LOCAL lc_Hex, lc_Result
lc_Result = ''
DO while (len(tn_String) > 0)
lc_Hex = '0x' + left(tn_String,2)
lc_Result = lc_Result + chr(val(lc_Hex))
tn_String = alltrim(substr(tn_String, 3))
ENDDO
RETURN lc_Result
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement