HMETAFILE CloseMetaFile(hdc) | |||||
HDC hdc; | /* handle of device context | */ |
The CloseMetaFile function closes a metafile device context and creates a handle of a metafile. An application can use this handle to play the metafile.
hdc
Identifies the metafile device context to be closed.
The return value is the handle of the metafile if the function is successful. Otherwise, it is NULL.
If a metafile handle created by using the CloseMetaFile function is no longer needed, you should remove it (using the DeleteMetaFile function).
The following example creates a device-context handle of a memory metafile, draws a line in the device context, retrieves a handle of the metafile, plays the metafile, and finally deletes the metafile.
HDC hdcMeta;
HMETAFILE hmf;
hdcMeta = CreateMetaFile(NULL);
MoveTo(hdcMeta, 10, 10);
LineTo(hdcMeta, 100, 100);
hmf = CloseMetaFile(hdcMeta);
PlayMetaFile(hdc, hmf);
DeleteMetaFile(hmf);