Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Vista

File Type Associations (part 2) - Change the Icon for All Files of a Type

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
10/18/2011 5:39:28 PM

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.

Figure 3. If an IconHandler is defined for a file type, Windows generates icons dynamically for each file instead of using the static icon referenced in the DefaultIcon key


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:

  1. Open the Registry Editor.

  2. 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.

  3. 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.

  4. Double-click the PerceivedType value, type image for its contents, and click OK.

  5. Next, navigate to HKEY_CLASSES_ROOT\SystemFileAssociations\image. This key provides common properties for all image files, such as .jpg, .bmp, and .tif files.

  6. 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.

  7. 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.


  8. The change should take effect immediately; if not, restart Windows to see the new icons.

Other -----------------
- Registry Tasks and Tools (part 5) - Back Up the Registry
- Registry Tasks and Tools (part 4) - Export and Import Data with Registry Patches & Prevent Changes to a Registry Key
- Registry Tasks and Tools (part 3) - Create an Interface for a Registry Setting
- Registry Tasks and Tools (part 2) - Find the Registry Key That Does...
- Registry Tasks and Tools (part 1) - Search the Registry & Search and Replace Registry Data
- The Registry (part 1) - The Registry Editor & The Structure of the Registry
- Custom Startups Using the Boot Configuration Data (part 2) - Using BCDEDIT to Customize the Startup Options
- Custom Startups Using the Boot Configuration Data (part 1) - Using Startup and Recovery to Modify the BCD & Using the System Configuration Utility to Modify the BCD
- Customizing and Troubleshooting the Windows Vista Startup : The Boot Process, from Power Up to Startup
- Using Control Panel and Group Policies : Implementing Group Policies with Windows Vista
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer