Share via


Create metafile from icon and label

Going further on the Windows Metafile problematic from a previous post, I’ve created a sample code for illustration a pretty useful functionality from OLE.

What the OLE function implemented here does is to generate a metafile with the icon and label for a specific file:

clip_image002

The way to do this is:

1. Call SHGetFileInfo to get the HICON associated to a specific extension

2. Call OleMetafilePictFromIconAndLabel for generating a metafile from a label and an icon

3. Call CopyMetaFile to save the memory metafile to a WMF file

Attached you can find the CPP and EXE for this sample.

MSDN documentation for this function:

https://msdn.microsoft.com/en-us/library/ms683934(VS.85).aspx

cmf.zip