../Other UI parts/ShellfoldersHome
Shellfolders & -objects
Create and add your own folders/objects at places you're not supposed to, and make them behave like shell objects.
Core of this page is about adding your folder to the My computer window, making it behave like any folder displayed there; that is, showing up in explorer, open/save dialogs, like other objects there. But aim is to provide some general information on shellfolders, so variations imagined could be made to work.
Most credit for this page goes to bittemei, there's some information added from beaker who found this article at winguides, plus we tested it on all platforms and made some changes accordingly. Lots of additional info plus neat script below provided by saunders.
Basically, there's two things you do here. That's (1) create an id for the folder at HKEY_CLASSES_ROOT in the registry (plus some subkeys to make it working), and (2) add that id to the "NameSpace" key for My computer. Likewise, there's NameSpace keys for the Desktop, Control Panel, Network Neighborhood you could add entries to.
Method used in the Winguides article above is the method to be used in 98 (Me ?), so we'll briefly feature that. It has some disadvantages (not browsable in explorer, popping up a new window everytime), which bittemei fixed, for 2k/XP. If you just want to add a folder quickly, find commented regfiles for download below.
Creating a shellfolder
First thing needed to do, create an unique CLSID for the folder/object at HKEY_CLASSES_ROOT\CLSID\ in the registry. A clsid is a "class ID", also referred to as a "universally unique identifier" (UUID) or "globally unique identifier" (GUID). In the registry, just a set of numbers between {}, telling Windows here's a special object...
A usable GUID is in example here, you can find more here. A freeware tool to create more is here.
Now, there's two subkeys needed to make this a full shellfolder, plus optional, another key and a string vlaue to define display a bit more:
  • You'll need a "InProcServer32" subkey, default value set to system .dll to handle the folder - we'll stick to "shell32.dll", for 98, bittemei found a method with "shdocvw.dll" working better for 2k/XP. Also create a string value there called "ThreadingModel", make it say "Apartment";
  • Also, you want a "ShellFolder" subkey, with a hex value "Attributes" inside. More on that here;
  • The "InfoTip" string value at root of the clsid is optional, any text is displayed there is displayed when you hover the icon;
  • Also optional is a "DefaultIcon" subkey. Make default value point to your icon if you'd like a custom one.
That defines an "existing" shellfolder. It doesn't open or do anything yet, it just resides there. Two things needed, it needs to be added somewhere (my computer or desktop namespace, just below), plus, way of being handled by explorer needs definition (98, 2k/XP).
Add it to NameSpace
My computer, the desktop, some others got a "NameSpace" key in registry where items can be added, that is, subkeys named after clsid created for your shellfolder (with the brackets). Here's how to add them for current user:

@="Folder name, the one actually displayed"

@="Folder name, the one actually displayed"

There's an old regtweak to add a rename option to the recycle bin. It involves the shellfolder subkey of the recycle bin clsid:
HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08 -00AA002F954E}\ShellFolder
There's a binary value usually set to "40 01 00 20" there. If you change it to "50 01 00 20" the bin gets the option added. Now we saw at HKEY_CLASSES_ROOT\CLSID\ there's lots more "objects", that's special folders, filetypes, dialogs, etc. Lots of shellfolder subkeys there too, with the binary "Attributes" value (some are dword, but rightclick, choose modify binary data and format is the same). We just added our own clsid there, so what can we set as options for our folder, besides rename option, what could possible be done with the object, looks and functionality ?!

Bittemei dug up quite a few, and I ended up only adding a few, they're very, very poorly documented, and most is found in programmer's resources concerning creating their own shell extensions. Anyway, here's the list, that is, descriptive command used by coders, what's set in the Attributes value and an attempt at explaining (read on on how to use):
SFGAO_CANRENAME 10 00 00 00 Object can be renamed;
SFGAO_CANDELETE 20 00 00 00 Object can be deleted;
SFGAO_HASPROPSHEET 40 00 00 00 Object have a property sheet;
SFGAO_CANCOPY 01 00 00 00 Object can be copied;
SFGAO_CANMOVE 02 00 00 00 Object can be moved;
SFGAO_CANLINK 04 00 00 00 Object can be linked;
SFGAO_DROPTARGET 00 01 00 00 Object can be pasted into;
SFGAO_NONENUMERATED 00 00 10 00 Object is a non-enumerated object (?);
SFGAO_NEWCONTENT 00 00 20 00 Object should show bold in explorer tree;
SFGAO_LINK 00 00 01 00 Object is shortcut (arrow);
SFGAO_SHARE 00 00 02 00 Object is shared (hand);
SFGAO_READONLY 00 00 04 00 Object has readonly attribute;
SFGAO_GHOSTED [/_HIDDEN] 00 00 08 00 Object has disabled look;
SFGAO_FILESYSANCESTOR 00 00 00 10 Object contain file system folder (?);
SFGAO_FOLDER 00 00 00 20 Object is a folder;
SFGAO_FILESYSTEM 00 00 00 40 Object is "part of the file system (that is,
they are files, directories, or root directories");
SFGAO_HASSUBFOLDER 00 00 00 80 Object contain folders
(expandable in explorer/plus sign);
SFGAO_VALIDATE 00 00 00 01 Invalidate cached information
(content is checked);
SFGAO_REMOVABLE 00 00 00 02 Object is on removable media;
SFGAO_COMPRESSED 00 00 00 04 Object is compressed (alt color);
SFGAO_BROWSABLE 00 00 00 08 The specified items can be browsed in place (?).
A detailed explanation on how to apply these we already covered here, though applied there at another registry key. But basically, it's a matter of adding the bits you want set up. The value has 8 bits, each bit has 4 settings: 1, 2, 4 and 8. Add any of those up and you'll have a unigue setting. If the bit says "9", can only be a combination of "1" and "8", right. But it's hex, so instead of setting 0-16 it's 0-F (10=A, 11=B etc). 4x8 = 32 possible settings, though not all space has to be occupied... would love some additions, corrections, explanations to that list :).
Check: "50 01 00 20", as for the bin above, is a simple addition of SFGAO_CANRENAME, SFGAO_HASPROPSHEET, SFGAO_DROPTARGET and SFGAO_FOLDER.
So, where's the cool things we can do ?! Oh, I dunno, didn't explore fully yet, this took quite a while already... managed to have my own shellfolder display a ghosted icon in 98, the rename/delete options seem to work mostly, bold display in explorer treeview doesn't work ?...
XP, maybe 2k, at HKEY_CLASSES_ROOT\CLSID\{0afaced1-e828-11d1-9187-b532f1e9575d}
\ShellFolder, which is the clsid for a general folder shortcut, setting both the "Attributes" (dword) value and another one called "CallForAttributes" to 0x00000000 (0) makes some things work that won't without doing so (being browsable in explorer etc).
The 98 regfile
For 98, to have the folder actually opened, you need to point the InProcServer32 key to shell32.dll, and add the "Shell" subkey, plus "Open" and "Command" subkeys underneath, then point the last to explorer.exe. Like this:


@="Folder name, optional, overridden at namespace key"
"InfoTip"="Your description"





@="Explorer.exe /e,/idlist,/L,x:\\pathto\\yourfolder"

The 2k/XP regfile
For 2k/XP, bittemei found you can skip the shell/open/command sequence. You could still use them, but they produce a new window always, a non-browsable item in explorer treeview etc. Set the InProcServer32 key to shdocvw.dll, and you'll need "Instance" and "InitPropertyBag" subkeys. These are the proper settings:

Windows Registry Editor Version 5.00


@="Folder name, optional, overridden at namespace key"
"InfoTip"="Your description"
"{305ca226-d286-468e-b848-2b2e8e697b74} 2"=dword:ffffffff





Like said, you can add entries at multiple places. If you add the clsid at HKEY_LOCAL_MACHINE, your folder will be displayed for all users of the computer:


Another thing, we've been talking about folders here, but a shell object doesn't have to be a folder. Take for instance the link to IE that's on the desktop on older OS's. No shortcut arrow, no delete option, it has a GUID and set attributes.
This is even more simple, just create a new clsid at HKCR again, use the Shell\Open\Command subkeys from the 98 regfile to set an opening command, and add the Shellfolder subkey to set attributes. Then add to namespace where desired. Find a great example here!

For 2k/XP (not working in 98), bittemei also dug up the registry entries to add an item to Folder options, a checkbox to toggle display of your folder in My Computer:

Windows Registry Editor Version 5.00


"Text"="Show Foldername in My Computer"

To display options there for displaying the icon/folder on the desktop, there's actually two HKCU keys, related to style of startmenu (:p...), saunders found out:


As the HKEY_LOCAL_MACHINE part would be overwritten, three instances of it, like MyFolder1, MyFolder2, MyFolder3 are needed.
So, we may have made it look more complicated than necessary, here's some stuff to get back to basics:
Quest: a property sheet
We've set SFGAO_HASPROPSHEET for its attributes. That's because we want one, working. For that, there's usually a new subkey created at the HKCR\CLSID\{CLSID}, named "ShellEx", with another subkey called "PropertySheetHandlers", and one more subkey underneath, a new {clsid} value. Like:


Now some of those in registry point to their own clsid, like above, because explorer/their .dll has a property sheet inside, other point to different shellfolder clsid's. So far, we've found some at HKEY_CLASSES_ROOT\Directory\shellex\ that make some sense - {ef43ecfe-2ab9-4632-bf21-58909dd177f0} - and some others are working too, but giving nonsense results. Is there a proper clsid to apply here, that works and makes sense ?! Would just finish the tweak ;)..

xhtml 1.1