Description

Sets the notify rules for some sink.

Return Type

A mcobjNotifyRuleFlags enumeration.  

The new mcobjNotifyRuleFlags rules flags. The existing flags may be retrieved by calling SetNotifyRules with a RuleFlagsMask argument of mcobjNR_NoFlags.

Syntax

object.SetNotifyRules (dwCookie, [RuleFlags], [RuleFlagsMask])

The SetNotifyRules Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McObjects.
dwCookieRequired. An ULong object.

The “cookie” value returned from a previous call to AttachNotifySinkToCategory, AttachNotifySinkToType or McObject.AttachNotifySink. The “cookie” will be the same for all AttachNotify... calls sharing the same notify sink interface instance (the piunkINotifySink - IUnknown* AttachNotify argument). Note that this implies that the same notify rules apply to any attached notify for the same sink interface.

RuleFlagsOptional. A mcobjNotifyRuleFlags enumeration, as described in settings.

The rules flags. Currently the only one supported is mcobjNR_NoAddRefSinkInterface, which prevents a reference from being kept on the notify sink.

RuleFlagsMaskOptional. A mcobjNotifyRuleFlags enumeration, as described in settings.

An optional mask for the rules flags to change. By default all rule flags are set or cleared by the RuleFlags argument.

Settings

The settings for RuleFlags are:

ConstantValueDescription
 mcobjNR_NoFlags0

default rules, sink interfaces are referenced

 mcobjNR_NoAddRefSinkInterface1

Sink interfaces are not AddRef'ed. The sink interface must have some mechanism for ensuring that it calls DetachNotifySink on all of its attached notify McObject instances before it is fully Released.

 mcobjNR_AllFlagsMask65535

The default RuleFlagsMask for the flags to set or clear.

The settings for RuleFlagsMask are:

ConstantValueDescription
 mcobjNR_NoFlags0

default rules, sink interfaces are referenced

 mcobjNR_NoAddRefSinkInterface1

Sink interfaces are not AddRef'ed. The sink interface must have some mechanism for ensuring that it calls DetachNotifySink on all of its attached notify McObject instances before it is fully Released.

 mcobjNR_AllFlagsMask65535

The default RuleFlagsMask for the flags to set or clear.

Remarks

Currently the only rule that can be set is whether a reference is held on the notify sink interface while any notify to it is attached.

By default, whenever a notify sink is attached to an McObject instance, Type or Category (by a call to McObject.AttachNotifySink, AttachNotifySinkToCategory or AttachNotifySinkToType) a reference (AddRef) is placed on the notify sink interface. This reference is then released (Release) when the last attached notify on the sink interface is detached (either by a call to McObject.DetachNotifySink, DetachNotifySinkFromCategory, DetachNotifySinkFromType or automatically when the the last notifiying McObject is removed from the McObjects collection). This reference may sometimes create a “deadlock” problem, so you may use this SetNotifyRules method to prevent the AddRef/Release on the notify sink interface. If you do so, you must establish some other method to keep a reference on the notify sink interface until you have detached all attached notifies.