The two examples illustrate two ways to supply the McUserMeasureObject argument, an instance of the McUserMeasure dual interface. The approach shown in Example 1 requires that you implement all five methods of the McUserMeasure interface in a separate class module. Example 1 is slightly more complex than Example 2, and this approach means that you have to add a Tools->References to the "Media Cybernetics Regions Operators Library" named McRegionLib. On the other hand, execution of these methods is faster, since several layers of overhead are eliminated. And as shown, only the ComputeValue method must be supplied; the others can be left empty.
The WithEvents method illustrated in Example 2 is simpler, since no extra type library reference is required, and you only have to supply the event methods that you want to implement (and of those only the ComputeValue method is required). However, this method is substantially slower than supplying a full implementation of McUserMeasure.
When a measurement is unregistered, all existing instances of the measurement are released.
When a measurement is registered or unregistered, a SNC_NOTIFY_HO_PROPERTYCHANGED SpecialNotify is fired with data ID_IMcEngine_RegisterUserMeasurement. This notify can be tracked to populate or depopulate lists of available measurements.