OleGetIconOfFile function (ole2.h)

Returns a handle to a metafile containing an icon and string label for the specified file name.

Syntax

HGLOBAL OleGetIconOfFile(
  [in] LPOLESTR lpszPath,
  [in] BOOL     fUseFileAsLabel
);

Parameters

[in] lpszPath

A pointer to a file for which the icon and string are to be requested.

[in] fUseFileAsLabel

Indicates whether to use the file name as the icon label.

Return value

If the function succeeds, the return value is a handle to a metafile that contains and icon and label for the specified file. If there is no CLSID in the registration database for the file, then the function returns the string "Document". If lpszPath is NULL, the function returns NULL.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ole2.h
Library Ole32.lib
DLL Ole32.dll

See also

OleGetIconOfClass

OleMetafilePictFromIconAndLabel