GetWinMetaFileBits function (wingdi.h)

The GetWinMetaFileBits function converts the enhanced-format records from a metafile into Windows-format records and stores the converted records in the specified buffer.

Syntax

UINT GetWinMetaFileBits(
  [in]  HENHMETAFILE hemf,
  [in]  UINT         cbData16,
  [out] LPBYTE       pData16,
  [in]  INT          iMapMode,
  [in]  HDC          hdcRef
);

Parameters

[in] hemf

A handle to the enhanced metafile.

[in] cbData16

The size, in bytes, of the buffer into which the converted records are to be copied.

[out] pData16

A pointer to the buffer that receives the converted records. If lpbBuffer is NULL, GetWinMetaFileBits returns the number of bytes required to store the converted metafile records.

[in] iMapMode

The mapping mode to use in the converted metafile.

[in] hdcRef

A handle to the reference device context.

Return value

If the function succeeds and the buffer pointer is NULL, the return value is the number of bytes required to store the converted records; if the function succeeds and the buffer pointer is a valid pointer, the return value is the size of the metafile data in bytes.

If the function fails, the return value is zero.

Remarks

This function converts an enhanced metafile into a Windows-format metafile so that its picture can be displayed in an application that recognizes the older format.

The system uses the reference device context to determine the resolution of the converted metafile.

The GetWinMetaFileBits function does not invalidate the enhanced metafile handle. An application should call the DeleteEnhMetaFile function to release the handle when it is no longer needed.

To create a scalable Windows-format metafile, specify MM_ANISOTROPIC as the fnMapMode parameter.

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

Requirements

Requirement Value
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

DeleteEnhMetaFile

Metafile Functions

Metafiles Overview

SetMapMode

SetWinMetaFileBits