Deleting registry values from HKEY_CURRENT_USER
Posted: Tue Aug 29, 2006 12:02 pm
Hello,
The installation for my application is writing some application settings to the HKEY_LOCAL_MACHINE. The application is using these as default, and if user is changing the settings, they are stored in the HKEY_CURRENT_USER.
When I remove the application, the HKLM values are of course removed OK. How can I achieve the removal of HKCU?
I tried to add the Delete Registry command, and this works to some extent. I will give an examlpe.
The application is storing its data in the key:
HKCU\\Software\\Company\\Product\\5.0\\...
5.0 is just a sample of the version, depending on the app version it differs.
I could use the Delete Registry command, and delete the key
HKCU\\Software\\Company\\Product\\5.0
But this leaves the key HKCU\\Software\\Company\\Product in the registry.
If I would delete HKCU\\Software\\Company\\Product, it could happen that installer of version 5.0 would delete version 4.0.
I didn't find a way with Delete Registry command, how to do this - would need to check, if after Removal of registry key HKCU\\Software\\Company\\Product\\5.0 the HKCU\\Software\\Company\\Product is empty, and then remove this one as well.
Uff, I hope I didn't make this too complicated. The safe solution is to write some custom code in a DLL, and call it during install. If there is a recommended way how to do this with native commands, it would be of course great.
Another question here is, how to remove the HKCU registry for all users, that have used the application - not just the user, who is removing the application. Do you have any suggestions?
Thanks
Andrej
The installation for my application is writing some application settings to the HKEY_LOCAL_MACHINE. The application is using these as default, and if user is changing the settings, they are stored in the HKEY_CURRENT_USER.
When I remove the application, the HKLM values are of course removed OK. How can I achieve the removal of HKCU?
I tried to add the Delete Registry command, and this works to some extent. I will give an examlpe.
The application is storing its data in the key:
HKCU\\Software\\Company\\Product\\5.0\\...
5.0 is just a sample of the version, depending on the app version it differs.
I could use the Delete Registry command, and delete the key
HKCU\\Software\\Company\\Product\\5.0
But this leaves the key HKCU\\Software\\Company\\Product in the registry.
If I would delete HKCU\\Software\\Company\\Product, it could happen that installer of version 5.0 would delete version 4.0.
I didn't find a way with Delete Registry command, how to do this - would need to check, if after Removal of registry key HKCU\\Software\\Company\\Product\\5.0 the HKCU\\Software\\Company\\Product is empty, and then remove this one as well.
Uff, I hope I didn't make this too complicated. The safe solution is to write some custom code in a DLL, and call it during install. If there is a recommended way how to do this with native commands, it would be of course great.
Another question here is, how to remove the HKCU registry for all users, that have used the application - not just the user, who is removing the application. Do you have any suggestions?
Thanks
Andrej