Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How read/write to registry?
Message
From
18/04/2005 21:51:31
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00988761
Message ID:
01006038
Views:
23
Sergy:
I (too) need... a function to write a product code to registry. I'm running VFP9 in WinXp Pro, however, the code fails at the point shown and indicates a Data Type Mismatch.

Thanks in advance for your generous help!
regfile = HOME(2)+"classes\registry.prg"
ccHKEY_CURRENT_USER = -2147483647
oReg = NEWOBJECT("Registry", HOME(2)+"classes\registry.prg")
* Open or Create registry key 'My Company'
IF oReg.OpenKey("Software\My Company", ccHKEY_CURRENT_USER, .T.) <> 0
 * error
ENDIF

* Set registry value 'Procuct Key'
IF oReg.Setkeyvalue("Procuct Key", "1234567890")
  *  Fails here   error = Data Type Mismatch
ENDIF
* Close key
oReg.closekey()
* Open registry key 'My Company'
IF oReg.OpenKey("Software\My Company", ccHKEY_CURRENT_USER) <> 0
  * error
ENDIF
* Read 'Procuct Key' value data
lcProductKey = ""
IF oReg.Getkeyvalue("Procuct Key", @lcProductKey) <> 0
  * error
ENDIF
* Close key
Regards,

dg
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform