2. Change the Icon for All Files of a Type
Every
file type has a default icon, the icon shown for all files with
filename extensions linked to that type. Yet Vista offers no way to
choose your own icons—apart from editing the Registry directly—despite
the fact that you could do this right in Windows Explorer in previous
versions of Windows.
The (Default) value in the DefaultIcon
key mentioned in the previous section contains the full path and
filename of the file containing the default icon. Often it points right
to the application executable that uses the file (e.g., excel.exe for .xls files), but sometimes it references a .dll or .ico file containing a bunch of icons. The filename is then followed by a comma and then a number (called the index) that indicates which icon to use. For example:
C:\Program Files\Photoshop\Photoshop.exe,15
points to the file Photoshop.exe, located in the C:\Program Files\Photoshop folder, and references the 16th icon in that file (0 or no number indicating the first icon, 1 indicating the second, and so on).
Occasionally, you may see something like this in the DefaultIcon key:
%SystemRoot%\system32\wmploc.dll,−731
Here, %SystemRoot% is a variable that represents the Windows folder (usually C:\Windows). When the (Default) value in which this information is stored is an expandable string value , Windows converts the filename to C:\Windows\System32\wmploc.dll before retrieving the icon. You may also sometimes notice a negative value following the filename (−731, in this case) which represents the resource ID of the icon to use—as opposed to a positive value indicating the index (position) of the icon as described earlier.
In most cases, you can specify your own icon for a given file type by placing the full path to an .exe, .dll, .ico, or .bmp file in the DefaultIcon key's (Default) value. (Hint: there are some nice icons in \Windows\System32\shell32.dll.)
Include a number to indicate which icon to use, or leave out the number
to use the first icon in the file. In some cases, Windows Explorer will
recognize the change right away, although due to the way Vista caches
icons, you may need to restart Windows for your change to fully take
effect.
The only time when Windows won't pay attention to the icon specified in the DefaultIcon key is when an IconHandler is defined. IconHandlers generate dynamic icons on the fly (Figure 3), typically showing thumbnails of the files' contents in lieu of static icons.
An IconHandler is a program—typically a .dll
file in the program folder of the application with which the file is
associated—that understands the file format. For instance, Adobe Acrobat
(version 7.0 and later) makes use of this feature to facilitate
thumbnail previews for .pdf files in Windows Explorer. For the .pdf filename extension, Acrobat's IconHandler could be referenced in any of these Registry keys:
HKEY_CLASSES_ROOT\.pdf\ShellEx\IconHandler
HKEY_CLASSES_ROOT\.pdf\ShellEx\{BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}
HKEY_CLASSES_ROOT\AcroExch.Document.7\ShellEx\IconHandler
HKEY_CLASSES_ROOT\AcroExch.Document.7\ShellEx\{BB2E617C-0920-11D1-9A0B-
00C04FC2D6C1}
HKEY_CLASSES_ROOT\SystemFileAssociations\.pdf\ShellEx\IconHandler
HKEY_CLASSES_ROOT\SystemFileAssociations\.pdf\ShellEx\{BB2E617C-0920-11D1-
9A0B-00C04FC2D6C1}
HKEY_CLASSES_ROOT\SystemFileAssociations\image\ShellEx\IconHandler
HKEY_CLASSES_ROOT\SystemFileAssociations\image\ShellEx\{BB2E617C-0920-11D1-
9A0B-00C04FC2D6C1}
As it turns out, Adobe chose the fourth key to register its IconHandler. The (Default) value in that key contains a 38-digit class ID that points to an entry in HKEY_CLASSES_ROOT\CLSID, which in turn contains all the details about the .dll file.
If the reference to the IconHandler is contained in one of the keys named IconHandler, the .dll is responsible for the dynamically generated icon. But newer programs will use the {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1} key, which facilitates image previews for the Preview pane in Windows Explorer, as well as dynamic icons.
|
|
Once you find the reference to the IconHandler, you can delete the key—either the IconHandler key or the {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1} key—to disable the IconHandler and allow Windows Explorer to use the static icon defined in the DefaultIcon key.
But
what if you want to fix a broken file type for which icon previews have
stopped working? Often it's easier to just reinstall the associated
application to repair the IconHandler keys, but if that application is
Windows itself, then you'll probably want to follow these steps to
reinstate icon previews on your PC:
Open the Registry Editor.
Navigate
to the Registry key for the filename extension you want to modify. For
instance, if you want to enable icon previews for TIFF files, go to HKEY_CLASSES_ROOT\.tif.
Look for a PerceivedType value inside the .tif key. If it's not there, select Edit → New → String Value, and type PerceivedType for its name.
Double-click the PerceivedType value, type image for its contents, and click OK.
Next, navigate to HKEY_CLASSES_ROOT\SystemFileAssociations\image. This key provides common properties for all image files, such as .jpg, .bmp, and .tif files.
Open the ShellEx key, and look for a key named {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}. If it's not there, select Edit → New → Key, and type {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1} for the name of the new key.
Open the {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1} key, and double-click the (Default) value. Type {3F30C968-480A-4C6C-862D-EFC0897BB84B} for its contents, and click OK when you're done.
Of the two Class IDs mentioned here, {BB2E617C-0920-11d1-9A0B-00C04FC2D6C1} connects the file type to Windows Explorer's Preview pane, and {3F30C968-480A-4C6C-862D-EFC0897BB84B} points to Windows' own PhotoMetadataHandler.dll, the .dll file responsible for generating icon previews for all supported photo file formats. |
|
The change should take effect immediately; if not, restart Windows to see the new icons.