So cool! ... [Opened/Closed folder icons in Vista / Win7]

Wednesday, September 23, 2009

Written by Jacques Bensimon:

I was looking at how TweakUI from the XP PowerToys manages to change the Explorer shortcut overlay icon (from the standard arrow to a smaller gray arrow or to nothing at all) and, with InCtrl5, found that it creates the new Registry key “HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons” and writes there a REG_SZ entry named “29” with value “C:\Windows\System32\TweakUI.exe,3” (for the “no arrow” option).  Looking at TweakUI.exe with “Resource Hacker”, sure enough its 4th icon group is a totally blank (i.e. transparent) icon  -- you start the count at 0, so the “,3” in the icon specification means the 4th icon group in the executable.  Fair enough, so now why is the entry named “29”?  Well, I again used “Resource Hacker”, this time on shell32.dll, and found out that its 30th icon group is the one that corresponds to the standard shortcut overlay arrow.  So, putting the two together, I conclude that the “Shell Icons” reg key is a way of “redirecting” Explorer from one or more of its standard (shell32.dll) icons to others of your choice, in this case saying “redirect icon group 29 from the standard arrow icon in shell32.dll to the blank icon in TweakUI.exe”.

So now, looking further at the icon groups in shell32.dll, I see that its 4th icon group corresponds to the “closed folder” icon and its 5th icon group corresponds the “open folder” icon (on Windows XP), and this makes me think of one of my Vista (and now Windows 7) pet peeves, namely that Explorer (and most annoyingly Regedit) in their navigation panes use the same “open folder” icon whether a folder (or key) is in fact opened or closed.  If you don’t know what I’m talking about, compare Regedit on XP/2003 to Regedit on Vista/2008/7:  if you have a value highlighted in the right pane of Regedit, on XP/2003 you can easily see what key you’re in by looking in the left pane at the key that has the “open folder” icon, but on Vista/2008/7, *all* the keys have the “open folder” icon regardless, so you don’t know where you are unless the key’s path is fully available in the status bar (long key paths are truncated) or you hit F6 to go back to the navigation pane, which highlights the current key.

Now I look (again with “Resource Hacker”) at shell32.dll on a Windows 2008 machine and discover that *both* its 4th and 5th icon groups are *identical*, and both look like “open folder”, which explains the above observation (I can’t decide whether MS screwed up or did it on purpose for some reason I can’t fathom).  So, just for kicks, I now create the “Shell Icons” reg key on the 2008 machine and add the entry “3” with value “C:\Windows\System32\shell32.dll,23”.  If you’re wondering, the 24th icon group in shell32.dll is the blue “?” Help icon.  The results?

Registry  Blue Icons

So now I just have to find a proper “closed folder” icon group I like (either in shell32.dll or elsewhere) that has available all the same sizes and color depths as shell32.dll and redo the “3” Registry entry accordingly, and pet peeve gone!  It’s kind of cool that Regedit is affected by this change, obviously the result of using the same shell TreeView control as Explorer. 

If you look around, you’ll probably find a whole bunch of other apps and utilities that are also affected, e.g. the Start Menu itself (!) and any program that uses the standard shell file/folder selection dialogs. One last item:  According to the TweakUI GUI (written if you didn’t know by one of the principal developers on the team that wrote Explorer, a guy named Raymond Chen who used to be, and for all I know may still be, very active on MS newsgroups), the shortcut overlay icon change feature is a *system-wide* modification, so I don’t think creating the “Shell Icons” key under HKCU would have any effect.

Of course, if the reason MS chose to use the identical icon for open and closed folders is because doing otherwise will hose your system, I never mentioned any of this.  In fact, you never even heard of me.

Next Post »