Description

Checks the Type property to see if it is “compatible” with a given type

Return Type

A Boolean value.  

TRUE if this object's type is “compatible” with the type given by the TypeNameOrEnumToCheck argument.

Syntax

object.IsCompatibleType (varTypeNameOrEnum)

The IsCompatibleType Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McObject.
varTypeNameOrEnumRequired. A Variant value.

Remarks

A “compatible” type is a type that is the same as the given type or is one derived from it. You would use this method to determine if an McObject is one that has capabilities supported by some type.

Types are organized in a hierarchy, so that for example, mcobjTypeCHAR (an 8-bit character type) is derived from mcobjTypeBYTE (an 8-bit numeric type) and mcobjTypeLONG is derived from mcobjTypeINTEGER (both being 32-bit signed integrals). Derived types have all of the capabilities of any of their base types.

User types registered with RegisterType all have a “base type” from which they are derived. Since the RegisterType “base type” can also be used as a "base type", a hierarchy of types may be developed. For example a type named “McFeatures” could be registered as based on mcobjTypeXOBJECT. Then derived types named “McRegions”, “McLines” and “McPoints” could be registered based on the “IMcFeatures” type. McObjects of types “McRegions”, “McLines” and “McPoints” could be created and assigned Value properties that were IDispatch interfaces (which is what an mcobjTypeXOBJECT holds) that all exposed an interface derived from the McFeatures. Then IsCompatibleType can be used to check for any McObject holding an interface that exposes an McFeatures interface. This check is illustrated in Example 2.

If the TypeNameOrEnumToCheck is given by name, the type name must be within the scope of the current Namespace property of the CreatorCollection. Use the “::” syntax to specfify the type namespace directly.

Exceptions

If a type name is given to check, it must be the name of a built in or registered type.