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 13:22:28
 
 
To
12/02/2003 08:01:58
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00752228
Message ID:
00752360
Views:
11
>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

VFP doesnt have a type of DWORD or WORD or BYTE. It all can be access (read/write) by VFP as a string of chars. So depends on what you need. If you need a DWORD then combine 4 chars into one string. If you need WORD then combine 2 chars into one string. If you need BYTE, then one char already represent as a BYTE. So string of chars also represent as array of bytes.
Herman
Previous
Reply
Map
View

Click here to load this message in the networking platform