EnumMetaFile

Syntax

BOOL EnumMetaFile(hDC,hMF,lpCallbackFunc,lpClientData)

This function enumerates the GDI calls within the metafile identified by the hMF parameter. The EnumMetaFile function retrieves each GDI call within the metafile and passes it to the function pointed to by the lpCallbackFunc parameter. This callback function, an application-supplied function, can process each GDI call as desired. Enumeration continues until there are no more GDI calls or the callback function returns zero.

Parameter Type/Description  

hDC HDC Identifies the device context associated with the metafile.  
hMF LOCALHANDLE Identifies the metafile.  
lpCallbackFunc FARPROC Is the procedure-instance callback function. See the following “Comments” section for details.  
lpClientData BYTE FAR * Points to the callback-function data.  

Return Value

The return value specifies the outcome of the function. It is nonzero if the callback function enumerates all the GDI calls in a metafile; otherwise, it returns zero.

Comments

The callback function must use the Pascal calling convention and must be declared FAR.

Callback Function

int FAR PASCAL EnumFunc(hDC, lpHTable, lpMFR, nObj, lpClientData)
HDC hDC;
LPHANDLETABLE lpHTable;
LPMETARECORD lpMFR;
int nObj;
BYTE FAR * lpClientData;

EnumFunc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition file.

Parameter Description  

hDC Identifies the special device context that contains the metafile.  
lpHTable Points to a table of handles associated with the objects (pens, brushes, and so on) in the metafile.  
lpMFR Points to a metafile record contained in the metafile.  
nObj Specifies the number of objects with associated handles in the handle table.  
lpClientData Points to the application-supplied data.  

Return Value

The function can carry out any desired task. It must return a nonzero value to continue enumeration, or a zero value to stop it.