Enabling Two-State Animation of Icons in Grid View of the Start Menu

4/8/2010

An application can be enabled to support two-state animation of icons corresponding to files using the SHGetFileInfo function and registry changes. The registered selected icon for a file can be obtained by passing the SHGFI_SELECTICON flag to SHGetFileInfo function 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 SHGetFileInfo can not find a registered select icon for a file when SHGFI_SELECTICON was requested, it will return the default icon.

Registry changes to enable two-state animation of icons

In addition to the DefaultIcon key, a new SelectIcon key 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:

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,

[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