Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How read/write to registry?
Message
De
18/04/2005 21:51:31
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows '98
Database:
Visual FoxPro
Divers
Thread ID:
00988761
Message ID:
01006038
Vues:
22
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform