IExtractIconW interface (shlobj_core.h)

Exposes methods that allow a client to retrieve the icon that is associated with one of the objects in a folder.

Inheritance

The IExtractIcon interface inherits from the IUnknown interface. IExtractIcon also has these types of members:

Methods

The IExtractIconW interface has these methods.

 
IExtractIconW::Extract

Extracts an icon image from the specified location. (Unicode)
IExtractIconW::GetIconLocation

Gets the location and index of an icon. (Unicode)

Remarks

There are two ways to retrieve an object's icon. The simplest way is to call SHGetFileInfo. However, this approach is inflexible and may be slow. A more flexible and efficient way to retrieve an item's icon is to use IExtractIcon. The Shell uses IExtractIcon to retrieve icons when it displays the contents of a folder. To use IExtractIcon to retrieve an object's icon, do the following:

  1. Get a pointer to the IShellFolder interface of the folder that contains the object.
  2. Call IShellFolder::GetUIObjectOf with the pointer to an item identifier list (PIDL) of the object and the interface ID of IExtractIcon (IID_IExtractIcon). The folder creates an object to handle the icon extraction, and returns the object's IExtractIcon interface pointer.
  3. Call IExtractIcon::GetIconLocation to retrieve the icon's location.
  4. Call IExtractIcon::Extract to retrieve the icon's handle.
It may also be possible to extract icons asynchronously on a background thread. This approach is useful when extraction is a time-consuming operation. For details, see IExtractIcon::GetIconLocation.

Namespace extensions implement IExtractIcon to provide icons for their objects. A client obtains an IExtractIcon interface pointer for an object in a folder by calling the folder's IShellFolder::GetUIObjectOf method. The IShellFolder::GetUIObjectOf implementation must create an object to handle the icon extraction and return a pointer to the object's IExtractIcon interface.

Icon handlers also implement IExtractIcon. An icon handler is a type of Shell extension handler that allows you to dynamically assign icons to the members of a file type.

Call this interface if your application needs a more flexible way to retrieve an object's icon than SHGetFileInfo.

Note

The shlobj_core.h header defines IExtractIcon as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlobj_core.h