EnumObj

  WORD EnumObj(lpDestDev, wStyle, lpCallbackFunc, lpClientData)    
  LPPDEVICE lpDestDev;    
  WORD wStyle;    
  FARPROC lpCallbackFunc;    
  LPVOID lpClientData;    

The EnumObj function enumerates the pens and brushes available on the device. GDI calls EnumObj when an application calls the EnumObjects function (GDI.71). For each object having the given style, EnumObj calls the callback function with the logical information for that object. EnumObj continues to call the callback function until there are no more objects or the callback function returns zero.

Every graphics driver must export an EnumObj function.

Parameters

lpDestDev

Points to a PDEVICE or PBITMAP structure specifying the destination device or bitmap.

wStyle

Specifies whether to enumerate pens or brushes. This parameter can be one of the following values.

Value Meaning

1 Enumerates pens
2 Enumerates brushes

EnumObj enumerates all objects of the given type. If there are no objects of the given type, the function must return 1.

lpCallbackFunc

Points to the user-supplied callback function.

lpClientData

Points to the user-supplied data.

Return Value

The return value is the last value returned by the callback function. Otherwise, it is 1 if there are no objects of the given type.

Comments

The export ordinal for this function is 7.

The callback function has the following form:

WORD CallbackFunction(lpLogObj, lpClientData)
LPVOID lpLogObj;
LPSTR lpClientData;

Parameter Description

lpLogObj Points to a LPEN or LBRUSH structure, depending on the wStyle parameter.
lpClientData Points to the user-supplied data passed to EnumObj.

Before calling the callback function, EnumObj must fill the LPEN or LBRUSH structure with the logical colors and other values that correspond to a given physical pen or brush.

To support some older applications (such as Microsoft Excel for versions earlier than 2.1), EnumObj specifies the 8 default EGA colors in the first 8 objects it enumerates.

EGA color RGB value

Black 0,0,0
White 0xFF,0xFF,0xFF
Red 0xFF,0,0
Green 0,0xFF,0
Blue 0,0,0xFF
Yellow 0xFF,0xFF,0
Magenta 0xFF,0,0xFF
Cyan 0,0xFF,0xFF

If the driver supports additional colors, EnumObj can specify those colors in any order. Since some applications end the enumeration after the first 16 colors, the second 8 colors to enumerated should be the most desirable colors of the device.

EnumObj should enumerate solid pens before styled lines. Enumerating styled pens is optional. The function should enumerate:

Solid pens

Styled pens (optional)

Solid brushes (no dithered colors)

Hatched brushes

EnumObj does not need to specify the background colors for hatched brushes.

See Also

EnumDFonts