METAFILES

A metafile is a collection of GDI functions that are encoded in a binary form. You create a metafile by first creating a metafile device context. You can then use most of the GDI drawing functions to draw on this metafile device context. These GDI calls don't really draw on anything, however. Instead, they are stored within the metafile. When you close the metafile device context, you get back a handle to the metafile. You can then ”play“ this metafile on a real device context and execute the GDI functions in the metafile.

Metafiles are used most often for sharing pictures between programs through the clipboard. Because metafiles describe a picture as a collection of GDI calls, they take up much less space and are more device independent than bitmaps. I'll begin the discussion of metafiles with some simple examples, and then I'll take up the more theoretical considerations.