Description

Sets up to automatically attach either a standard (IID_IMcObjStandardNotify) or custom sink notification interface to any object which is created of a given type.

Return Type

An ULong object.  

Notify sink “cookie” identifier for this sink interface. This “cookie” value is the same for the same sink piunkINotifySink for all notify attach methods (McObject.AttachNotifySink, AttachNotifySinkToCategory and AttachNotifySinkToType).

Note: Sinks are not attached during creation of mcobjTypeFlagAlias (see Add) objects. This behavior differs from the notification set up by AttachNotifySinkToCategory, which does attach notify sinks when Alias type objects are added to a category.

Syntax

object.AttachNotifySinkToType (varTypeNameOrEnum, varISinkIID, piunkISink)

The AttachNotifySinkToType Method syntax has these parts:

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

The type name or type enum to attach to.

varISinkIIDRequired. A Variant value.

The ISink interface IID. This may be a VT_BSTR in which case the it must be the IID string in the form “{12345678-1234-1234-1234-123456789ABC}”. If VT_I4 or VT_UI4, then it must be a cookie from a previous call to either AttachNotifySink or CMcObjects::AttachNotifySinkToCategory. If VT_EMPTY, a NULL pointer or IID_IMcObjStandardNotify, the notify sink is to be a standard one.

piunkINotifySink : Instance of the sink interface to notify. If the varISinkIID argument was VT_EMPTY, a NULL pointer or IID_IMcObjStandardNotify, then QueryInterface on this pointer must yield an IMcObjStandardNotify*.

piunkISinkRequired. An Unknown object.

Remarks

A McObject may be created in two ways: explicitly by calling the Add method, or implicitly by a call to GetCategoryItem for an “auto add” item name registered by the AttachAutoAddToCategory method. In both of these cases, notify sinks attached here will be automatically added as notify sinks, just as if McObject.AttachNotifySink had been called. If any of the notify sinks attached are IMcObjStandardNotify sinks, then they will immediately receive an IMcObjStandardNotify.ObjectCreated notify method call.