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.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in ole2.h.
  Import Library: Included as a resource in ole32.dll.

See Also

OleGetIconOfClass, OleMetafilePictFromIconAndLabel