Description

Returns a count of all McObjects in one category with some particular (or no) parent object, as filtered by SetEnumFilters.

Return Type

A Long value.  

Count of all McObjects in the collection.

Syntax

object.GetCategoryCount (varCategoryNameOrID, [varParentIMcObject], [eControlFlags])

The GetCategoryCount Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McObjects.
varCategoryNameOrIDRequired. A Variant value.

Category name or ID (as returned from RegisterCategory).

varParentIMcObjectOptional. A Variant value.

Parent object for the collection, or missing (VT_EMPTY or VT_ERROR) for global objects.

eControlFlagsOptional. A mcobjEnumFiltersFlags enumeration, as described in settings.

Settings

The settings for eControlFlags are:

ConstantValueDescription
 mcobjEnumDefault0

Default flags

 mcobjEnumMustMatchName1

The object's name must match the the bstrNameRegExpr argument exactly. This means that for an empty bstrNameRegExpr argument only un-named objects will pass. If this is not set, the bstrNameRegExpr is treated as a standard UNIX grep-like regular expression (e.g., “[Bb].*” will pass all names starting with upper or lower case 'B').

 mcobjEnumAllParents2

If this flag is set, then for a VT_EMPTY or VT_ERROR varParentIMcObject (the default) an object with any or no parent is allowed. When the flag is set and varParentIMcObject is non-NULL, then an object with any ancestor (i.e., its parent or its parent's parent, etc.) matching varParentIMcObject is allowed. If this flag is not set (this is the default state), then an object must exactly match the varParentIMcObject to pass the filter; thus if varParentIMcObject is NULL, only globals will pass.

 mcobjEnumAllCreators4

If set, objects created by any McObjects collection instance are passed, otherwise only objects created by this McObjects collection instance are enumerated.

 mcobjEnumDataNotObject8

The returned list of variants will contain the object's data, instead of the default VT_DISPATCH McObject*.

 mcobjEnumAliasOrShadow16

If set, Alias type objects are passed as well as normal, non-alias objects.

 mcobjEnumAliasOnly32

If set, only Alias type objects are passed. Normal, non-alias objects fail the test. If neither this flag or the mcobjEnumAliasOrShadow flag is set, then only normal, non-alias objects are passed.

 mcobjEnumResetToNoFilter256

Any existing SetEnumFilters is cleared. For a SetEnumFilters call, all other arguments are ignored. For a GetCategoryCount or GetCategory_NewEnum call, this ensures any previous SetEnumFilters call is ignored, so that the arguments given to the method fully determine the enumeration.

Remarks

The count takes into account any filters which have been set by the SetEnumFilters method. You may use the mcobjEnumResetToNoFilter eControlFlags bit to ensure that no previous SetEnumFilters call will disturb an enumeration. Note that the enumeration filters are also automatically cleared by any call to GetCategory_NewEnum or they can be cleared with a call to SetEnumFilters with the eControlFlags set to mcobjEnumResetToNoFilter.

By default only objects that were created by this instance of McObjects will be included in the count. Set the mcobjEnumAllCreators flag in the eControlFlags argument or make a prior call to SetEnumFilters with this flag set to override this behavior.

By default only normal, non-alias objects are enumerated. Set either the mcobjEnumAliasOrShadow or mcobjEnumAliasOnly flags in the eControlFlags argument or make a prior call to SetEnumFilters with one of these flags set to override this behavior.

If the SetEnumFilters method has been called, then the mcobjEnumDataNotObject, mcobjEnumAllCreators, mcobjEnumAliasOrShadow, or mcobjEnumAliasOnly flags could be set by either it's eControlFlags argument or with this method's eControlFlags argument; however the mcobjEnumAllParents always comes from the SetEnumFilters call (see Notes).

If SetEnumFilters has been called before this call, then the SetEnumFilters varParentIMcObject argument and mcobjEnumAllParents eControlFlags bit control the parent test; the corresponding arguments here are ignored. Thus, if SetEnumFilters is used you must supply the proper varParentIMcObject argument (and any mcobjEnumAllParents eControlFlags bit) there.