Collapse the table of content
Expand the table of content
Expand Minimize
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

EnumEnhMetaFile function

The EnumEnhMetaFile function enumerates the records within an enhanced-format metafile by retrieving each record and passing it to the specified callback function. The application-supplied callback function processes each record as required. The enumeration continues until the last record is processed or when the callback function returns zero.


BOOL EnumEnhMetaFile(
  _In_       HDC           hdc,
  _In_       HENHMETAFILE  hemf,
  _In_       ENHMFENUMPROC lpEnhMetaFunc,
  _In_       LPVOID        lpData,
  _In_ const RECT          *lpRect


hdc [in]

A handle to a device context. This handle is passed to the callback function.

hemf [in]

A handle to an enhanced metafile.

lpEnhMetaFunc [in]

A pointer to the application-supplied callback function. For more information, see the EnhMetaFileProc function.

lpData [in]

A pointer to optional callback-function data.

lpRect [in]

A pointer to a RECT structure that specifies the coordinates, in logical units, of the picture's upper-left and lower-right corners.

Return value

If the callback function successfully enumerates all the records in the enhanced metafile, the return value is nonzero.

If the callback function does not successfully enumerate all the records in the enhanced metafile, the return value is zero.


Points along the edge of the rectangle pointed to by the lpRect parameter are included in the picture. If the hdc parameter is NULL, the system ignores lpRect.

If the callback function calls the PlayEnhMetaFileRecord function, hdc must identify a valid device context. The system uses the device context's transformation and mapping mode to transform the picture displayed by the PlayEnhMetaFileRecord function.

You can use the EnumEnhMetaFile function to embed one enhanced-metafile within another.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Wingdi.h (include Windows.h)





See also

Metafiles Overview
Metafile Functions



Community Additions

© 2015 Microsoft