HMETAFILE GetMetaFile(lpszFile) | |||||
LPCSTR lpszFile; | /* address of metafile name | */ |
The GetMetaFile function creates a handle of a specified metafile.
lpszFile
Points to the null-terminated string that specifies the MS-DOS filename of the metafile. The metafile is assumed to exist.
The return value is the handle of a metafile if the function is successful. Otherwise, it is NULL.
The following example uses the CopyMetaFile function to copy a metafile to a specified file, plays the copied metafile, uses the GetMetaFile function to retrieve a handle to the copied metafile, uses the SetWindowOrg function to change 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);