Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add custom entry to Windows XP explorer context menu

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
I am trying to add sdelete.exe to the right click menu in Windows XP Sp3 for all files including shortcuts and all folders but not objects on the desktop like Recycle Bin, My Documents, My Computer etc.

What I would really like is a shell extension that adds it in complete with icon but my research tells me I would need to write a dll program to create the custom Context Menu Handler then I would have the GUID key to reference it in the registry. But hey enough about this solution I do not have the knowledge to write such a dll and unless someone else has and can post a link to it then I must proceed with the following solution.

All the tutorials on the web that I can find say that the following registry entry will add “Permanently Delete” to the upper most group of the right click menu in XP.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Permanently Delete]

[HKEY_CLASSES_ROOT\*\shell\Permanently Delete\command]
@="\"sdelete.exe\" /p 1 /s \"%1\""


[HKEY_CLASSES_ROOT\Directory\shell\Permanently Delete]
"Icon"="imageres.dll,-89"
"position"="Bottom"

[HKEY_CLASSES_ROOT\Directory\shell\Permanently Delete\command]
@="\"sdelete.exe\" /p 1 /s \"%1\""

But I have found a problem with potentially disastrous results. It concerns the default menu value for whatever you clicked on ie folder, file, shortcut etc the registry edit seems to change this and assume the default and I can not find a way to make it right. I am aware of the Folder Options… File Types set Default procedure but this is something else and does not help with this registry entry.

When I right click on a folder the top part of the menu looks like this:-

Before registry key added.
Open
Explore
Search…
--line separator—

After registry key added.
Permanently Delete
Open
Explore
Search…
--line separator—

but if I change the following “Directory” with “Folder” it seems to work. So why is that, why do all the articles say to use “Directory” and which is correct:-

[HKEY_CLASSES_ROOT\Folder\shell\Permanently Delete]
"Icon"="imageres.dll,-89"
"position"="Bottom"

[HKEY_CLASSES_ROOT\Folder\shell\Permanently Delete\command]
@="\"sdelete.exe\" /p 1 /s \"%1\""

Before registry key added..
Open
Explore
Search…
--line separator—

After registry key added
Open
Explore
Search…
Permanently Delete
--line separator—

and when I right click on a file its just as confusing because if there is more than one entry in the upper most group then “Permanently Delete” is added beneath them which is correct but if there is only one entry for example “Open With…” then it is added above this and in bold which is default value and not at all what we want.

Before registry key added.
Open With…
--line separator—

After registry key added.
Permanently Delete
Open With…
--line separator—

As the default ie bold menu items are those which are executed not only on right click and select but also on simply double clicking the item then you can very easily delete files instantly.

If any one knows how to create the registry entry correctly so that it works properly all the time for all files, folders and shortcuts except desktop objects as mentioned this would be a great help.

 
instead of using Folder or Directory why not use AllFilesystemObjects...

see the reg-code below:
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Permanently Delete]

[HKEY_CLASSES_ROOT\*\shell\Permanently Delete\command]
@="\"sdelete.exe\" /p 1 /s \"%1\""


[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Permanently Delete]
"Icon"="imageres.dll,-89"
"position"="Bottom"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Permanently Delete\command]
@="\"sdelete.exe\" /p 1 /s \"%1\""

AllFilesystemObjects is not only for Folders, but applies to files as well, and the Desktop items also...

Ben
"If it works don't fix it! If it doesn't use a sledgehammer..."
How to ask a question, when posting them to a professional forum.
Only ask questions with yes/no answers if you want "yes" or "no"
 
Thanks BadBigBen

But like I said I do not want to include objects on the desktop like Recycle Bin, My Documents, My Computer etc.

Any ideas on why the reg examples I posted behave the way they do and how to correct this.


 
Thank you for taking a look BadBigBen
Maybe someone else might know the answer.
It sure has me puzzled.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top