Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to transform a string into a byte type ?
Message
From
12/02/2003 08:01:58
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
How to transform a string into a byte type ?
Miscellaneous
Thread ID:
00752228
Message ID:
00752228
Views:
56
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
Next
Reply
Map
View

Click here to load this message in the networking platform