Qbasicnews.com

Full Version: Stupid registry...grrrrrrrrrrrr
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, here's the deal...I'm writing an uninstall application, and it's suposed to delete the values and then the keys. Well, it deletes the values just fine, but then when it comes to the keys, it has no idea what the hell to do. I'm using RegDeleteValue for deleting the values, and RegDeleteKey as the attempt to clear out the keys after the values are all gone. I have read that you can just use RegDeleteKey and it will wipe out all values, but I already tried that as well, and it didn't do squat. So...anyone got any ideas as to why the API call wouldn't work?
delete the key then the value?
Take a look: http://msdn.microsoft.com/library/defaul...etekey.asp

Maybe it could be this sentence...:
Quote:A deleted key is not removed until the last handle to it has been closed.

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.

Windows Me/98/95: 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.
I don't know if this applies to your situation since I don't know which OS you are using... :roll:
Quote:delete the key then the value?

That is impossible!

ado: Which version of windows are you talking about? I recently made an application for WinXP and it has given me nightmares!
I'm writing the app in Win98SE but the OS is irrelevant since the function is universal across all Win32 platforms. And the last handle IS being closed...*sigh* oh well, guess I'll keep tinkering. Big Grin

You can't delete the values after the key, because the values are contained within the key. Big Grin
Okay, figured it out...you have to alias RegDeleteKeyA for it to work...no tutorial anywhere explained that, and actually, they consistently gave the wrong prototype. Fixed now. Thanks for the help though, guys. Big Grin