Platform SDK: Windows GDI |
The PlayEnhMetaFile function displays the picture stored in the specified enhanced-format metafile.
BOOL PlayEnhMetaFile( HDC hdc, // handle to DC HENHMETAFILE hemf, // handle to an enhanced metafile CONST RECT *lpRect // bounding rectangle );
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Windows NT/ 2000: To get extended error information, call GetLastError.
When an application calls the PlayEnhMetaFile function, the system uses the picture frame in the enhanced-metafile header to map the picture onto the rectangle pointed to by the lpRect parameter. (This picture may be sheared or rotated by setting the world transform in the output device before calling PlayEnhMetaFile.) Points along the edges of the rectangle are included in the picture.
An enhanced-metafile picture can be clipped by defining the clipping region in the output device before playing the enhanced metafile.
If an enhanced metafile contains an optional palette, an application can achieve consistent colors by setting up a color palette on the output device before calling PlayEnhMetaFile. To retrieve the optional palette, use the GetEnhMetaFilePaletteEntries function.
An enhanced metafile can be embedded in a newly created enhanced metafile by calling PlayEnhMetaFile and playing the source enhanced metafile into the device context for the new enhanced metafile.
The states of the output device context are preserved by this function. Any object created but not deleted in the enhanced metafile is deleted by this function.
To stop this function, an application can call the CancelDC function from another thread to terminate the operation. In this case, the function returns FALSE.
Windows 95/98: PlayEnhMetaFile is subject to the limitations of the GDI. For example, Windows 95/98 supports only 16-bit signed coordinates. For records that contain 32-bit values, Windows 95/98 fails to play the record if the values are not in the range –32,768 to 32,767.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Wingdi.h; include Windows.h.
Library: Use Gdi32.lib.
Metafiles Overview, Metafile Functions, CancelDC, GetEnhMetaFileHeader, GetEnhMetaFilePaletteEntries, RECT, SetWorldTransform