OleMetafilePictFromIconAndLabel function (ole2.h)

Creates a metafile in which the specified icon and label are drawn.

Syntax

HGLOBAL OleMetafilePictFromIconAndLabel(
  [in] HICON    hIcon,
  [in] LPOLESTR lpszLabel,
  [in] LPOLESTR lpszSourceFile,
  [in] UINT     iIconIndex
);

Parameters

[in] hIcon

Handle to the icon that is to be drawn into the metafile. This parameter can be NULL. If hIcon is NULL, this function returns NULL without creating a metafile.

[in] lpszLabel

The icon label. This parameter can be NULL. If lpszLabel is NULL, the resulting metafile will not include a label.

[in] lpszSourceFile

The path and file name of the icon file. This string can be obtained through the user interface or from the registration database. This parameter can be NULL.

[in] iIconIndex

The location of the icon within the file named by lpszSourceFile, expressed as an offset in bytes from the beginning of file.

Return value

A global handle to a METAFILEPICT structure containing the icon and label. The metafile uses the MM_ANISOTROPIC mapping mode.

If an error occurs, the returned handle is NULL. In this case, the caller can call GetLastError to obtain further information.

Remarks

This function is called by OleGetIconOfFile and OleGetIconOfClass.

If lpszSourceFile is not NULL and iIconIndex is not 0, the name of the source file passed in lpszSourceFile and the index passed by iIconIndex are added to the created metafile as a comment record.

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

OleGetIconOfFile