Description

Removes the object from the collection and kills it by freeing its data

Return Type

A Long value.  

The remaining reference count on the object. This should never be zero, since one reference should be necessary to call this method. If it is 1, then any subsequent single Release will delete the object.

Syntax

object.KillObjectAndChildren

The KillObjectAndChildren Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McObject.

Remarks

This McObject and any descendent McObject's are removed from the McObjects collection and any data held by these objects is freed (thus “killing” them by rendering them unusable). The McObject instance(s) are Released, but are only actually deleted when the object's reference count reaches zero.

A call to this method will not delete the refered to object immediately, since the calling application will have bumped the reference count. The object will be deleted only when the last reference to the object is released.

However, after this call, the object (and any descendents) is non-functional and none of its methods or properties may be accessed. Any such access will result in an “Invalid Handle” error. And in any case, the object will no longer appear in any McObjects enumeration (e.g., a “for each” statement). Also any Name property used by a “killed” object is available for subsequent reuse. If you want to remove an object from the collection without killing it and its descendents, use the RemoveFromCollection method.

Once an object has been removed from the collection, there is no mechanism for putting it back in.