2.15.3 Changing How Windows Plays a Metafile

A metafile does not have to be played back in its entirety or exactly in the form in which it was recorded. An application can use the EnumMetaFile function to locate a specific metafile record. EnumMetaFile calls a callback function supplied by the application and passes it the following information:

The metafile device context

A pointer to the metafile handle table

A pointer to a metafile record

The number of associated objects with handles in the handle table

A pointer to application-supplied data

The callback function can then use this information to play a single record, to query the record, to copy it, or to modify it.

The PlayMetaFileRecord function plays a metafile record by executing the GDI function contained in the record.

When Windows plays or enumerates the records in a metafile, it identifies each object with an index into a handle table. Functions that select objects (such as SelectObject and SelectPalette) identify the object by means of the object handle that the application passes to the function.

Objects are added to the table in the order in which they are created. For example, if a brush is the first object created in a metafile, the brush is given index 0. If the second object is a pen, it is given index 1, and so on. For information about the format of the handle table, see the description of the HANDLETABLE structure in the Microsoft Windows Programmer's Reference, Volume 3.