(Applicable à Windows)
La fonction RegSetValue associe la clé du registre spécifiée à une chaîne de texte.
Format de la fonction :
RegSetValue(hKey as Integer, subkey as String, value as String) as Boolean
Identifie une clé ouverte ou une clé prédéfinie. Le paramètre hKey peut avoir l'une des valeurs prédéfinies suivantes :
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Identifie le nom de la sous-clé à définir.
Identifie la valeur de chaîne à définir dans la variable.
En cas de réussite, la fonction renvoie la valeur True. Dans le cas contraire, elle renvoie la valeur False.
Exemple :
Dim hkey1, hkey2, hkey3 as integer
Dim cBuf as string
Dim ccBuf[47] as char
Dim bBuf[100] as byte
Dim i as integer
ClrScr()
for i = 0 to 99
bBuf[i] = i
next i
cBuf = "1234567890ßqwertzuiopü+asdfghjklöä#<yxcvbnm,.-"
ccBuf = cBuf
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "LOGICIEL")
if hkey1 = 0 then
Print("Echec de RegOpenKey.")
quitter
endif
hkey2 = RegCreateKey(hkey1, "Technologie CA")
if hkey2 = 0 then
Print("Echec de RegCreateKey 1.")
quitter
endif
if Not(RegSetValue(hkey1, "CA", "International")) then
Print("Echec de RegSetValue")
endif
hkey3 = RegCreateKey(hkey2, "pour test uniquement")
if hkey3 = 0 then
Print("Echec de RegCreateKey 2.")
quitter
endif
if Not(RegSetVariable(hkey3, "var_1", 123)) then
Print("Echec de RegSetVar 1.")
endif
if Not(RegSetVariable(hkey3, "var_2", "Chaîne")) then
Print("Echec de RegSetVar 2.")
endif
if Not(RegSetVariable(hkey3, "var_3", cBuf, 46)) then
Print("Echec de RegSetVar 3.")
endif
if Not(RegSetVariable(hkey3, "var_4", bBuf, 100)) then
Print("Echec de RegSetVar 4.")
endif
if Not(RegSetVariable(hkey3, "var_5", cBuf, 46, REG_SZ)) then
Print("Echec de RegSetVar 5.")
endif
if Not(RegSetVariable(hkey3, "var_6", ccBuf, 46, REG_SZ)) then
Print("Echec de RegSetVar 5.")
endif
if Not(RegCloseKey(hkey3)) then
Print("Echec de RegCloseKey pour hkey3.")
endif
if Not(RegCloseKey(hkey2)) then
Print("Echec de RegCloseKey pour hkey2.")
endif
if Not(RegCloseKey(hkey1)) then
Print("Echec de RegCloseKey pour hkey1.")
endif
|
Copyright © 2014 CA Technologies.
Tous droits réservés.
|
|