How do I add an item to Finder's sidebar?

How do you add an item to Explorer's ShellNew menu?

  • I give up! Just how in the hell do you add an item to Explorer's ShellNew menu? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/context.aspTo add a file-creation command to the New submenu, your application's files must have a file class associated with them. Include a ShellNew subkey under the file extension key. When the File menu's New command is selected, the Shell will add it to the New submenu. The command's display string will be the descriptive string that is assigned to the program's ProgID. Assign one or more data values to the ShellNew subkey to specify the file creation method. The available values follow. [...]So here's what I have: a file extension ".build" under HKEY_CLASSES_ROOT, with a ProgID of "NAnt.Buildfile." There's a "ShellNew" key under that with a "NullFile" value attached. (I want to use a template or possibly write a wizard, but I'll settle for getting the simplest case working first!) I've set up a corresponding "NAnt.Buildfile" key to give the file class a friendly name, a default icon, and a couple of verbs (Edit and Build). According to MSDN, this is more than the minimum required, but no new entry appears in the ShellNew menu; however, ".build" files appear with the icon I selected and fully-functional Edit and Build verbs. Figuring this is Windows and nothing is as easy as a couple registry entries, I've searched for some sort of API call I need to make to get Explorer to recognize the ShellNew entry but I've come up empty. Help!

  • Answer:

    Find your current ShellNew folder (mine is C:\WINNT\ShellNew) and within it place a file named sample.build that contains whatever content you want a .build file to contain by default. Go back into regedit. Under .build, create a new key called ShellNew. Under ShellNew, create a new string value called FileName whose value is the name of the file you created above. Close regedit and check the ShellNew menu.

kjh at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Still nada.

kjh

Did you wait a bit and/or try rebooting after following the above advice? Windows has a tendency to cache file association data until it's forced to update. You might try installing http://www.microsoft.com/ntworkstation/downloads/PowerToys/Networking/NTTweakUI.asp, going to the Repair tab, and rebuilding icons to flush the cache. Barring that, delete your .build and NAnt.Buildfile keys and their contents from the registry, dump the following into a .reg file, and double-click to add: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.build] @="NAnt.Buildfile" [HKEY_CLASSES_ROOT\.build\ShellNew] "FileName"="sample.build" [HKEY_CLASSES_ROOT\NAnt.Buildfile] @="Build File" [HKEY_CLASSES_ROOT\NAnt.Buildfile\DefaultIcon] @="shell32.dll,1" [HKEY_CLASSES_ROOT\NAnt.Buildfile\shell] @="open" [HKEY_CLASSES_ROOT\NAnt.Buildfile\shell\open] [HKEY_CLASSES_ROOT\NAnt.Buildfile\shell\open\command] @="\"notepad.exe\" \"%1\"" Provided the sample.build file is still in your ShellNew directory, and your file association cache is refreshed afterward, this should work well enough for you to build up. It works for me, at least.

Danelope

Finally! That did it, though for the life of me I can't tell how it's different from what I had. Thanks, Danelope!

kjh

If I understand correctly, can't the same thing be achieved a lot easier by dropping a file into http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx's Templates list? That's how I usually add items to the New menu.

milov

Oops, I see you mention trying an API call so I guess this is something you're trying to do automatically in a program you're writing.

milov

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.