Class Overview: OXMetaFile

COXMetaFile is a class that allows access to metafiles in different formats: 

old Windows 3.x metafile (*.wmf) 
Windows metafile with Aldus header (*.wmf) 
new enhanced Windows metafile (*.emf) 

Loading the MetaFile from a disk file
The files can be loaded from disk. Use the LoadFile() method. If you don't set the filename then COXMetaFile will prompt the user for it, using a standard CFileDialog. COXMetaFile supports all different metafile formats and recognizes them internally. 

Loading the MetaFile from a resource
The Metafile can be loaded from an application resource file. You just call LoadFile( nID ) with the corresponding resource ID set. Normally it's a user defined resource type called "METAFILE", but other names are possible. This is a useful feature if you want to start your program with a screen picture loaded from within the program or come up with a default picture if a metafile is not found on disk. 

Play a metafile
All you need to do is to call the PlayFile method in your CMyView::OnDraw() method. 
pDoc->m_MetaFile.PlayFile (pDC); 

If you want to display the metafile in the client rectangle and maintain the metafile's ratio, you have to pass the client rectangle to PlayFile: 
pDoc-m_MetaFile.PlayFile (pDC, &rectClient); 

The MetaFile class will internally adjust the MapMode, WindowExt and ViewportExt according to the Metafile size.

Create a Metafile (enhanced format)
COXMetaFile only creates enhanced metafiles. 
You must call CreateFile() to create the MetaFile. This method will prompt the user for a filename if it is not passed as a parameter. 
Second, you need to perform all drawing operations on the DC returned by CreateFile()
Finally close the metafile using CloseFile().