GetWinMetaFileBits

  UINT GetWinMetaFileBits(hemf, cbBuffer, lpbBuffer, fnMapMode, hdcRef)    
  HENHMETAFILE hemf; /* handle of the enhanced metafile */
  UINT cbBuffer; /* buffer size */
  LPBYTE lpbBuffer; /* pointer to buffer */
  INT fnMapMode; /* mapping-mode identifier */
  HDC hdcRef; /* handle of reference device-context */

The GetWinMetaFileBits function converts the enhanced-format records from the metafile identified by hemf into the windows-format records and stores the converted records in the buffer at which lpbBuffer points.

Parameters

hemf

Identifies the enhanced metafile.

cbBuffer

Specifies the size, in bytes, of the buffer into which the converted records are copied. Only this many bytes will be written.

lpbBuffer

Points to the buffer into which the converted records are copied.

fnMapMode

Specifies the mapping mode that was used to create the picture that is stored in the enhanced metafile.

hdcRef

Identifies the reference device.

Return Value

If the function is successful, the return value is the size of the metafile data in bytes. Otherwise, it is zero.

Comments

This function is used to convert an enhanced metafile into an older windows-format metafile so that its picture can be displayed in an application that recognizes the older format.

If lpbBuffer is NULL, GetWinMetaFileBits returns the the number of bytes required to store the converted metafile records.

Windows uses the reference device context to determine the resolution of the original enhanced metafile.

The GetWinMetaFileBits function does not invalidate the enhanced metafile handle hemf. An application should free the handle by calling the DeleteEnhMetaFile function when it no longer needs the handle.

Due to the limitations of Windows 3.0, some information may be lost in the retrieved metafile contents. For example, an original PolyBezier call in the enhanced metafile may be converted into a Polyline call in the Windows metafile since there is no equivalent PolyBezier call in Windows 3.0.

Windows 3.x applications define the viewport origin and extents of a picture that is stored in a windows-format metafile. As a result, the windows-format records that are created by this function do not contain any SetViewportOrg and SetViewportExt calls. This function will, however, create windows-format records for the SetWindowExt and SetMapMode functions.

To create a scalable windows-format metafile, the fnMapMode parameter should specify MM_ANISOTROPIC.

The upper left corner of the metafile picture is always mapped to the origin of the reference device.

See Also

DeleteEnhMetaFile