An application can customize the icons that the shell displays for the
application's file types. The icon interface also allows an application to specify
icons for folders and subfolders within the application's file structure.
An application can specify icons for its file types in two ways. The simplest
way is to specify a class icon to be used for all files of a particular file
type by adding a DefaultIcon
key to the registry under the program information. For information about
specifying a class icon, see Setting Default Icons for File Classes
An application can use the %1 value with the DefaultIcon
key. This value denotes that each file instance of this type can have a
different icon. The application must supply an icon handler for the file type and
add an IconHandler
key to the shellex
key for the application. An application can have only one entry for the IconHandler
key, and the value of its key denotes the CLSID of the icon handler.
DefaultIcon = %1
To have customized icons, an application must provide an icon handler that
implements the IExtractIcon
interface. The system follows these steps when it is about to display an icon
for a file type that has instance-specific icons:
- Retrieves the class identifier of the handler.
- Creates a handler object by calling the CoCreateInstance function with the CLSID.
- Initializes the instance by calling the IPersistFile::Load member function.
- Uses the QueryInterface member function to get to the IExtractIcon interface.
- Calls the IExtractIcon::GetIconLocation and IExtractIcon::Extract member functions.
interface has the Extract
member functions in addition to the usual IUnknown
The system calls the GetIconLocation
member function to get the location and index of an icon to display.
Typically, the icon location is an executable or DLL filename, but it can be any file.
The system calls the Extract
member function when it needs to display an icon for a file that does not
reside in an executable or DLL file. Applications usually have the file icons in
their executable or DLL files, so icon handlers can simply implement this member
function as a return-only function that returns the E_FAIL error value. You
need to implement the Extract
member function only if the icon image is stored in a file in an
application-defined format. When the icon for a file is in a separate .ICO file (or any
other type of file), the icon handler must extract the icon for the shell and
return it in this member function.
- Software for developers
Software for Android Developers
- More information resources
Unix Manual Pages
- Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database