# OleGetIconOfFile

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

HGLOBAL OleGetIconOfFile(

LPOLESTR lpszPath, | //Pointer to string that specifies the file for which info is requested
BOOL fUseFileAsLabel | //Whether to use the file name as the icon label
); |

Parameters

lpszPath
  [in] Pointer to a file for which the icon and string are requested.
fUseFileAsLabel
  [in] Whether or not to use the file name as the icon label.

Return Value

HGLOBAL
  The hGlobal returned is a handle to a metafile that contains an icon and label for the specified file. If there is no CLSID in the registration database for the file, then the string “Document” is used. If the value of lpszPath is NULL, then NULL is returned.

See Also

OleGetIconOfClass, OleMetafilePictFromIconAndLabel