Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CDC::EnumObjects
CDC                                         Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  int EnumObjects( int nObjectType,
                   int ( FAR PASCAL EXPORT* lpfn )( LPSTR, LPSTR ),
                   LPSTR lpData );
 
  Parameter     Description
 
  <nObjectType> Specifies the object type. It can have the values
                OBJ_BRUSH or OBJ_PEN.
 
  <lpfn>        Is the procedure-instance address of the
                application-supplied callback function. See the "Remarks"
                section below.
 
  <lpData>      Points to the application-supplied data. The data is
                passed to the callback function along with the object
                information.
 
  Remarks
 
  Enumerates the pens and brushes available in a device context. For each
  object of a given type, the callback function that you pass is called
  with the information for that object. The system calls the callback
  function until there are no more objects or the callback function
  returns 0.
 
  Note that new features of Microsoft C/C++ let you use an ordinary
  function as the function passed to EnumObjects. The address passed to
  EnumObjects is a FAR pointer to a function exported with __export and
  with the Pascal calling convention. In protect-mode applications, you do
  not have to create this function with the Windows MakeProcInstance
  function or free the function after use with FreeProcInstance.
 
  You also do not have to export the function name in an EXPORTS statement
  in your application's module-definition file. You can instead use  the
  __export function modifier, as in
 
  int FAR PASCAL __export AFunction( LPSTR, LPSTR );
 
  to cause the compiler to emit the proper export record for export by
  name without aliasing. This works for most needs. For some special
  cases, such as exporting a function by ordinal or aliasing the export,
  you still need to use an EXPORTS statement in a module-definition file.
 
  For compiling Foundation programs, you'll normally use the /GA and /GEs
  compiler options. The /Gw compiler option is not used with the
  Foundation classes. (If you do use MakeProcInstance, you will need to
  explicitly cast the returned function pointer from FARPROC to the type
  needed in this API.) Callback registration interfaces are now type-safe
  (you must pass in a function pointer that points to the right kind of
  function for the specific callback).
 
  Also note that all callback functions must trap Foundation exceptions
  before returning to Windows, since exceptions cannot be thrown across
  callback boundaries. For more information about exceptions, see Chapter
  12 in the <Class Libraries User's Guide>.
 
  Callback Function
 
  The callback function passed to EnumObjects must use the Pascal calling
  convention and must be declared FAR.
 
  int FAR PASCAL __export ObjectFunc( LPSTR <lpLogObject>,
                                        LPSTR* <lpData> );
 
  The <ObjectFunc> name is a placeholder for the application-supplied
  function name. The actual name must be exported as described in the
  "Remarks" section above.
 
  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.
 
  Return Value
 
  The callback function returns an int. The value of this return is
  user-defined. If the callback function returns 0, EnumObjects stops
  enumeration early.
 
  Return Value
 
  Specifies the last value returned by the callback function. Its meaning
  is user-defined.
 
  See Also
 
  ::FreeProcInstance, ::MakeProcInstance, ::EnumObjects
 
 
                                     -♦-