from MSDN
SHDeleteKey
Deletes a subkey and all its descendants. The function will remove the key and all of the key's values from the registry.
DWORD SHDeleteKey(
HKEY hkey,
LPCTSTR pszSubKey
);
Parameters
hkey
Handle to the currently open key, or any of the following predefined values: HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_DYN_DATA (Windows 95 only)
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA (Windows NT only)
HKEY_USERS
pszSubKey
Address of a null-terminated string specifying the name of the key to delete.
Return Values
Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
Requirements
Version 4.71 and later of Shlwapi.dll
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later).
Header: Declared in shlwapi.h.
Import Library: shlwapi.lib.