Valid on Windows
The RegDeleteValue function deletes a value in the registry.
This registry manipulation function has the format:
RegDeleteValue(hkey as integer) as Boolean
Specifies the handle of the registry key from which to remove the associated value.
The return value is true if the function succeeds; otherwise, false.
Example: RegDeleteValue function
Test structure:
HKLM\
\ Software
\ CA
\ 4 test only
\ var_6
\ dummy
Dim hkey1 as integer
ClrScr()
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\CA\4 test only")
if hkey1 = 0 then
Print("RegOpenKey failed.")
exit
endif
if RegDeleteValue(hKey1) then
Print("RegDeleteValue succeeded.")
else
Print("RegDeleteValue failed.")
endif
if RegDeleteVariable(hKey1, "var_6") then
Print("RegDeleteVariable for var_6 succeeded.")
else
Print("RegDeleteVariable for var_6 failed.")
endif
RegCloseKey(hkey1)
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\CA")
if hkey1 = 0 then
Print("RegOpenKey failed.")
exit
endif
if RegDeleteKey(hkey1, "dummy") then
Print("Key dummy successfully deleted")
else
Print("Key dummy deletion failed.")
endif
RegCloseKey(hkey1)
Messagebox("Check registry!", "desktop management scripting test")
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE")
if hkey1 = 0 then
Print("RegOpenKey failed.")
exit
endif
if RegDeleteKey(hkey1, "CA\4 test only") then
Print("Key ""CA\4 test only"" successfully deleted")
else
Print("Key" "CA\4 test only" "deletion failed.")
endif
if RegDeleteKey(hkey1, "CA") then
Print("Key CA successfully deleted")
else
Print("Key CA deletion failed.")
endif
RegCloseKey(hkey1)
|
Copyright © 2013 CA.
All rights reserved.
|
|