I am having a problem with the registry I can't seem to figure out. I can't seem to delete a registry key from my program. I've done it like MSDN says, yet it doesn't work. Any help would be appreciated.
Post the code you're using.
Does the registry key have any subkeys? RegDeleteKey will only delete keys without any subkeys in NT/2K/XP.
As Skywing said:
The RegDeleteKey function deletes a subkey.
Windows 95/98/Me: The function also deletes all subkeys and values. To delete a key only if the key has no subkeys or values, use the SHDeleteEmptyKey function.
Windows NT/2000/XP: 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.
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.
Thank you very much Sky and Grok. Knew I could count on you. :)
I dunno if this is any help but http://www.pscode.com has some stuff about regestry editing
Heh, everyone refers to that page it seems. I got it under control though. Thanks ~