CopyEnhMetaFileW function (wingdi.h)

The CopyEnhMetaFile function copies the contents of an enhanced-format metafile to a specified file.

Syntax

HENHMETAFILE CopyEnhMetaFileW(
  [in] HENHMETAFILE hEnh,
  [in] LPCWSTR      lpFileName
);

Parameters

[in] hEnh

A handle to the enhanced metafile to be copied.

[in] lpFileName

A pointer to the name of the destination file. If this parameter is NULL, the source metafile is copied to memory.

Return value

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

If the function fails, the return value is NULL.

Remarks

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

Applications can use metafiles stored in memory for temporary operations.

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

Note

The wingdi.h header defines CopyEnhMetaFile as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

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