Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to transform a string into a byte type ?
Message
De
12/02/2003 08:01:58
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
How to transform a string into a byte type ?
Divers
Thread ID:
00752228
Message ID:
00752228
Vues:
58
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
Fil
Voir

Click here to load this message in the networking platform