HMETAFILE CopyMetaFile(hmfSrc, lpszFile) | |||||
HMETAFILE hmfSrc; | /* handle of metafile to copy | */ | |||
LPCSTR lpszFile; | /* address of name of copied metafile | */ |
The CopyMetaFile function copies a source metafile to a specified file and returns a handle of the new metafile.
hmfSrc
Identifies the source metafile to be copied.
lpszFile
Points to a null-terminated string that specifies the filename of the copied metafile. If this value is NULL, the source metafile is copied to a memory metafile.
The return value is the handle of the new metafile if the function is successful. Otherwise, it is NULL.
The following example copies a metafile to a specified file, plays the copied metafile, retrieves a handle of the copied metafile, changes the position at which the metafile is played 200 logical units to the right, and then plays the metafile at the new location:
HANDLE hmf, hmfSource, hmfOld;
LPSTR lpszFile1 = "MFTest";
hmf = CopyMetaFile(hmfSource, lpszFile1);
PlayMetaFile(hdc, hmf);
DeleteMetaFile(hmf);
hmfOld = GetMetaFile(lpszFile1);
SetWindowOrg(hdc, -200, 0);
PlayMetaFile(hdc, hmfOld);
DeleteMetaFile(hmfSource);
DeleteMetaFile(hmfOld);