Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Shell Interfaces
IExtractIcon
IExtractIcon Interface

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

IExtractIcon Members

Extract Extracts an icon image from the specified location.
GetIconLocation Gets the location and index of an icon.

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 class.

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

Interface Information

Minimum DLL Versionshell32.dll version 4.0 or later
Custom ImplementationYes
Inherits fromIUnknown
Headershlobj.h
Minimum operating systems Windows NT 4.0, Windows 95
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker