IExtractIconA 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 IExtractIconA interface has these methods.
IExtractIconA::Extract Extracts an icon image from the specified location. (ANSI) |
IExtractIconA::GetIconLocation Gets the location and index of an icon. (ANSI) |
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:
- Get a pointer to the IShellFolder interface of the folder that contains the object.
- 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.
- Call IExtractIcon::GetIconLocation to retrieve the icon's location.
- Call IExtractIcon::Extract to retrieve the icon's handle.
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 |