CreateMetaFile

  HDC CreateMetaFile(lpszFile)    
  LPCTSTR lpszFile;    

The CreateMetaFile function creates a device context for a Windows metafile.

Parameters

lpszFile

Points to the filename for the Windows metafile to be created. If NULL, the Windows metafile will be memory based and its contents will be lost when it is deleted in DeleteMetaFile.

Return Value

The return value identifies the device context for the Windows metafile if the function is successful. Otherwise, it is NULL.

Comments

The CreateMetaFile function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set).

This is a Windows metafile function.

This call is included only for compatibility purposes. Applications are discouraged from using this call. The Windows metafile functions support only Windows 3.x functionalities and do not record or playback new GDI functions such as PolyBezier. New applications should use the enhanced metafile functions.

The device context created in this function can be used to record GDI output calls in a Windows metafile. It should not be used with GDI query functions such as GetTextColor. When used with a GDI output function, the return value of that function becomes TRUE if the call is recorded and FALSE otherwise. When an object is selected in SelectObject, only a copy of the object is recorded. The object still belongs to the application.

To create a scalable Windows metafile, the graphics output should be recorded in the MM_ANISOTROPIC mapping mode. It should not modify the viewport origin and extents or contain device dependent calls such as SelectClipRgn. Once created, the Windows metafile can be scaled and rendered to any output devices by defining the viewport origin and extents of the picture before playing it.

See Also

CloseMetaFile, DeleteMetaFile