Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

An application can be enabled to support two-state animation of icons corresponding to files using the SHGetFileInfofunction and registry changes. The registered selected icon for a file can be obtained by passing the SHGFI_SELECTICON flag to SHGetFileInfofunction in addition to SHGFI_ICON. Since shortcut files or .lnk files can specify an icon explicitly as an override to the default for .lnk files, they can reference a registered class that determines both the default and selected icons.

Note that if SHGetFileInfocan not find a registered select icon for a file when SHGFI_SELECTICONwas requested, it will return the default icon.

Registry changes to enable two-state animation of icons

In addition to the DefaultIconkey, a new SelectIconkey can be added to the HKEY_CLASSES_ROOT\ <file class name>registry key. Typically the <file class name>represents the file class corresponding to a file extension such as .dll or .doc and is specified as the default value of the HKEY_CLASSES_ROOT\ <file extension>registry key, but a file class can also be specified for an individual shortcut file.

The format of the registry key that specifies selected icons is the same as the format used to specify the default icon:

Copy Code
HKEY_CLASSES_ROOT\<file class name>\SelectIcon
@=<module>,<offset>

where <module>is the file that contains the icon, and <offset>is the offset of the icon in the module.

For example,

Copy Code
[HKEY_CLASSES_ROOT\mediaplayerapp\DefaultIcon]
@="wmplayer.exe,-2001"
[HKEY_CLASSES_ROOT\mediaplayerapp\SelectIcon]
@="wmplayer.exe,-2003"

See Also

Other Resources

Start Screen and Start Menu