In the code below you can see how to delete a subkey or the entiry key
HKEY hKey = NULL;
long lReturn = RegOpenKeyEx( HKEY_USERS.
_T("folder \folder\ folder\{Key name}"),
0L,
KEY_SET_VALUE,
&hKey );
if (lReturn == ERROR_SUCCESS)
{
lReturn = RegDeleteValue(hKey, _T("value1"));
lReturn = RegDeleteValue(hKey, _T("value2"));
lReturn = RegCloseKey(hKey);
}
Now to delete the entire key:
lReturn = RegDeleteKey(HKEY_CURRENT_USER, _T("folder \folder\ folder\{Key name}"));