EnumObjects

Syntax

int EnumObjects(hDC,nObjectType,lpObjectFunc,lpData)

This function enumerates the pens and brushes available on a device. For each object that belongs to the given style, the callback function is called with the information for that object. The callback function is called until there are no more objects or the callback function returns zero.

Parameter Type/Description  

hDC HDC Identifies the device context.  
nObjectType int Specifies the object type. It can be one of the following values:  
  OBJ_BRUSH OBJ_PEN  
lpObjectFunc FARPROC Is the procedure-instance address of the application-supplied callback function. See the following “Comments” section for details.  
lpData LPSTR Points to the application-supplied data. The data is passed to the callback function along with the object information.  

Return Value

The return value specifies the last value returned by the callback function. Its meaning is user-defined.

Comments

The address passed as the lpObjectFunc parameter must be created by using the MakeProcInstance function.

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

Callback Function

int FAR PASCAL ObjectFunc(lpLogObject, lpData)
char FAR * lpLogObject;
char FAR * lpData;

ObjectFunc 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  

lpLogObject Points to a LOGPEN or LOGBRUSH data structure that contains information about the logical attributes of the object.  
lpData Points to the application-supplied data passed to the EnumObjects function.