Deletes a key or value from the registry.
1 if the value was deleted successfully, 0 if there was an error.
The Value parameter is treated as a boolean option. Setting Value to 0 will delete the key only if it has no sub keys. Setting Value to 1 will delete the key and all its sub keys. The default is 0.
If the service returns 0, then an error occurred. In this event, the Error parameter can be one of the following messages:
|"Failed to delete key"||The key could not delete.|
|"Failed to create value"||The value could not be deleted.|
|"Failed to open key"||The key could not be opened.|
The DELETE service deletes a key or value from the registry. If you supply both a Key and ValueName, then just the value is deleted and the Key is otherwise left unaltered. If you supply only a Key, leaving the ValueName blank, then the Key and all its values are deleted--with a caveat. If you leave the Value parameter unassigned or set it to 0, then the key is only deleted if it has no sub keys. If you set the value parameter to 1, then the key and all its sub keys and values are deleted. Setting Value to 1 is the surest way to delete a key, but also the most dangeous. Use it with caution. The Value parameter is ignored if ValueName is set.
If you need to delete keys and values more selectively, use the LISTVALUES or LISTKEYS service to enumerate a key's values and sub keys.