Deletes a subkey or a value in the Registry.
DeleteSetting hkey$, [subkey$] [,value$]
Deletes a key, subkey or value.
The registry stores data in a hierarchically structured tree. Each node in the tree is called a key. Each key can contain both subkeys and data entries called values.
The DeleteSetting command syntax has these arguments:
hkey$ | Required. String expression containing the name of the application or project to which the section or key setting applies. The value is saved under "\\hkcu\Software\" + hkey$. May include subkey$. |
subkey$ | Optional. String expression containing the name of the section where the key setting is stored. By default the value is saved under "\\hkcu\Software\" + hkey$ + "\" + subkey$. hkey$ may include subkey$; subkey$ is then omitted. |
value$ | Optional. String expression containing the name of the key setting to delete. |
When value$ = "" or when the value$ parameter is omitted the subkey will be deleted, however it must not have subkeys. GFA-BASIC 32 checks for the existence of descendants before deleting a subkey and a run time error occurs if there are.
SaveSetting "MyApp", "Startup\New", "Top", 75
SaveSetting "MyApp", "Startup\New", "Left", 50
DeleteSetting "MyApp", "Startup\New"
DeleteSetting "MyApp", "Startup"
DeleteSetting "MyApp"
This example first creates nested levels in \\HKCU\Software\MyApp and then deletes the nested levels one by one.
DeleteSetting conforms to the API function RegDeleteKey().
Windows NT and later have a built-in protection against deleting a subkey containing subkeys, Windows 95, 98, Me don't. The protection in DeleteSetting is necessary because recursive deletion of keys may cause disaster in case of an error in the parameters.
vbDeleteSetting, vbGetSetting, vbGetSettingType, vbDeleteSetting, GetSetting, GetSettingType, SaveSetting, DeleteSetting, CreateRegKey, OpenRegKey, CloseRegKey, GetRegVal, GetRegValName, GetRegValType, GetRegValNameCount, GetRegSubKey, GetRegSubKeyCount
{Created by Sjouke Hamstra; Last updated: 30/09/2014 by James Gaite}