Description

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

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 notified when an mcobjTypeFlagAlias (see Add) object is added to a Category. This behavior differs from the notification set up by AttachNotifySinkToType, which ignores Alias type objects.

Syntax

object.AttachNotifySinkToCategory (varCategoryNameOrID, varISinkIID, piunkISink)

The AttachNotifySinkToCategory Method syntax has these parts:

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

Category to auto attach to (see RegisterCategory).

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 McObjects.AttachNotifySinkToCategory. If VT_EMPTY, a NULL pointer or IID_IMcObjStandardNotify, the notify sink is to be a standard one.

piunkINotifySink : [in] 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 added to a category in two ways: explicitly by assigning to the McObject's Category property, 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.CategorySet notify method call.