Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to read registry values, other than strings?
Message
From
01/10/2000 01:15:14
 
 
To
29/09/2000 11:58:15
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00422632
Message ID:
00423220
Views:
18
>I'm using the \sample\solutions\registry class to read keys from the registry, but it will only read string (REG_SZ) values.
>
>how can I read a REG_DWORD?
>

Alter the code in REGISTRY.VCX to check for REG_DWORD type, and if so, convert the first 4 bytes of the buffer to a nuumber using something like DWORDToNum() in CLSHEAP. REG_DWORD values are 32 bit unsigned integers. If you plan to save them in an Integer field in VFP, they need to be recast as LONGs using BITOR(). The altered code looks something like:
* before the existing IF
IF m.lpdwType = REG_DWORD
   SET PROCEDURE TO CLSHEAP ADDITIVE
   m.cKeyValue = BITOR(DWORDToNum(m.cKeyValue),0)  && change to LONG
   RETURN ERROR_SUCCESS		
ENDIF
This uses the UDF() in CLSHEAP for conversion; code your own if you prefer.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform