PlayMetaFileRecord

2.x

  void PlayMetaFileRecord(hdc, lpht, lpmr, cHandles)    
  HDC hdc; /* handle of device context */
  HANDLETABLE FAR* lpht; /* address of table of object handles */
  METARECORD FAR* lpmr; /* address of metafile record */
  UINT cHandles; /* number of handles in table */

The PlayMetaFileRecord function plays a metafile record by executing the graphics device interface (GDI) function contained in the record.

Parameters

hdc

Identifies the device context of the output device.

lpht

Points to a table of handles associated with the objects (pens, brushes, and so on) in the metafile.

lpmr

Points to the metafile record to be played.

cHandles

Specifies the number of handles in the handle table.

Return Value

This function does not return a value.

Comments

An application typically uses this function in conjunction with the EnumMetafile function to modify and then play a metafile.

Example

The following example creates a dashed green pen and passes it to the callback function for the EnumMetaFile function. If the first element in the array of object handles contains a handle, that handle is replaced by the handle of the green pen before the PlayMetaFileRecord function is called. (For this example, it is assumed that the table of object handles contains only one handle and that it is a pen handle.)

MFENUMPROC lpEnumMetaProc;
HPEN hpenGreen;

lpEnumMetaProc = (MFENUMPROC) MakeProcInstance(
    (FARPROC) EnumMetaFileProc, hAppInstance);
hpenGreen = CreatePen(PS_DASH, 1, RGB(0, 255, 0));
EnumMetaFile(hdc, hmf, lpEnumMetaProc, (LPARAM) &hpenGreen);
FreeProcInstance((FARPROC) lpEnumMetaProc);
DeleteObject(hpenGreen);
    .
    .
    .

int FAR PASCAL EnumMetaFileProc(HDC hdc, HANDLETABLE FAR* lpHTable,
    METARECORD FAR* lpMFR, int cObj, BYTE FAR* lpClientData)
{
    if (lpHTable->objectHandle[0] != 0)
        lpHTable->objectHandle[0] = *(HPEN FAR *) lpClientData;
    PlayMetaFileRecord(hdc, lpHTable, lpMFR, cObj);

    return 1;
}

See Also

EnumMetafile, PlayMetaFile