General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only