IShellIcon::GetIconOf

[Now Supported on Windows NT]

Retrieves an icon for an object inside a specific folder.

HRESULT GetIconOf(

LPCITEMIDLIST pidl, // Points to an item identifier list
UINT flags, // Flags specifying the display state
LPINT lpIconIndex // Points to where the icon index is to be returned
);  

Parameters

pidl

Pointer to the ITEMIDLIST (item identifier list) structure that specifies the relative location of the folder.

flags

This parameter can be zero or one of the following values:

Value Meaning
GIL_FORSHELL The icon is to be displayed in a shell folder.
GIL_OPENICON The icon should be in the "open" state if both open- and closed-state images are available. If this flag is not specified the icon should be in the normal or "closed" state. This flag is typically used for folder objects.

lpIconIndex

Pointer to the location where the icon index will be returned.

Return Values

Returns NOERROR if lpIconIndex contains the correct system imagelist index. S_FALSE is returned if an icon cannot be obtained for this object.

The following standard imagelist indexes can be returned:

Value Meaning
0 Document (blank page, not associated)
1 Document (with data on the page)
2 Application (file extension must be .exe, .com, .bat)
3 Folder (plain)
4 Folder (open)

Remarks

If you are unable to get an icon for this object using GetIconOf, use IShellFolder::GetUIObjectOf to get an object that supports IExtractIcon::Extract.

Notes to Callers

The indexes returned are from the system image list.

Notes to Implementors

This method cannot be implemented external to the shell itself.

See Also

IShellIcon