Group: Registry - Library: advapi32
Class library providing access to the System Registry
LONG RegDeleteKey(
HKEY hKey,
LPCTSTR lpSubKey
);
DECLARE INTEGER RegDeleteKey IN advapi32;
INTEGER hKey,;
STRING lpSubKey
hKey [in] Handle to an open key.
lpSubKey [in] Pointer to a null-terminated string specifying the name of the key to be deleted.
If the function succeeds, the return value is ERROR_SUCCESS (0).
The key must have been opened with the DELETE access right.
hKey handle is returned by the RegCreateKeyEx or RegOpenKeyEx function, or it can be one of the following predefined keys:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
The subkey to be deleted must not have subkeys. To delete a key and all its subkeys, you need to recursively enumerate the subkeys and delete them individually. To recursively delete keys, use the SHDeleteKey function.