Knowledge Base

ShellBrowser Delphi Components



Question / Problem

How do I change the icon of a specific file type in the JamShellList?

Answer / Solution

If the new icon is also part of the system image list, then this can be easily achieved using the OnGetImageIndex event of the JamShellList. You can get the full name and path of a specific item in the list using the GetFullPath method.
To get the index of a specific file type icon, you can use the GetIndexFromExtension method of the TJamSystemImageList component.

Since the system image list is a global resource that is shared among all applications it cannot be changed easily. To add your custom icon to this image list you must register a file extension (a dummy one if necessary) with your icon in the system. This is done via the registry. Have a look here on the respective keys and how to manipulate them in Delphi: http://forum.codecall.net/topic/69184-solved-file-association-and-the-registry/

Note: Many installation builders can register icons for a specific file extension, e.g. InnoSetup