GetEnhMetaFileA function (wingdi.h)

The GetEnhMetaFile function creates a handle that identifies the enhanced-format metafile stored in the specified file.


  [in] LPCSTR lpName


[in] lpName

A pointer to a null-terminated string that specifies the name of an enhanced metafile.

Return value

If the function succeeds, the return value is a handle to the enhanced metafile.

If the function fails, the return value is NULL.


When the application no longer needs an enhanced-metafile handle, it should delete the handle by calling the DeleteEnhMetaFile function.

A Windows-format metafile must be converted to the enhanced format before it can be processed by the GetEnhMetaFile function. To convert the file, use the SetWinMetaFileBits function.

Where text arguments must use Unicode characters, use this function as a wide-character function. Where text arguments must use characters from the Windows character set, use this function as an ANSI function.


For an example, see Opening an Enhanced Metafile and Displaying Its Contents.


The wingdi.h header defines GetEnhMetaFile as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also



Metafile Functions

Metafiles Overview