|
-
Mar 18th, 2007, 03:04 AM
#1
Thread Starter
New Member
How to delete a subkey from windows registry?
Hi!! all,
I am developing a multimedia player. I wanted to add an context menu option, it will be displayed when user right-clicks on any multimedia file and when someone clicks that option it will load my player along with the selected file playing on it. I've done this. I've created this in win registry and its looks like this :-
HKEY_CLASSES_ROOT\*\shell\Play in Ex-MediaPlayer\command
after command, the default value contains the fullpath to my player's exe file. Now I want to remove the entire key chain from shell to command and the default value from registry. Can it be possible? If yes, then please help me. Its very urgent for me as I'm developing an uninstaller for my apps.
-
Mar 18th, 2007, 04:52 AM
#2
Re: How to delete a subkey from windows registry?
-
Mar 18th, 2007, 06:14 AM
#3
Re: How to delete a subkey from windows registry?
The safe way is to use RegDeleteKey on each of the subkeys in the branch, enumerating and checking each subkey for values (using RegEnumValue), just in case another app has used the same registry path as your own. That way you don't erase another progs settings. i.e. Although RegDeleteKey will delete a subkey which contains values, it won't delete a subkey which contains other subkeys (possibly written by another app) - hence the need to enumerate and check any values that may belong to another prog.
An API which will delete a subkey, and any other subkeys and values it contains, is SHDeleteKey. I must point out though, that if you erroneously pass the wrong branch/subkey to SHDeleteKey, it will wipe it out without question - possibly leaving you with the problem of re-installing an OS. You should create a .reg file backup - or restore point, just in case.
Last edited by schoolbusdriver; Mar 18th, 2007 at 06:22 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|