Implementing the IComponentData Interface

[This is preliminary documentation and subject to change.]

Every snap-in that extends the namespace must implement IComponentData. As noted earlier, this is one of the console's interfaces to the snap-in and is closely associated with the functionality of the items (folders) displayed in the scope pane.

Among the IComponentData methods, Initialize provides an entry point for the snap-in by allowing QueryInterface calls to the IConsole and IConsoleNamespace interfaces. Initialize must be called before the namespace can be enumerated. CreateComponent is used to create a snap-in's object that exposes the IComponent interface.

Notify is called by the console to inform the snap-in component of an event that has occurred as the application's end user clicks on the mouse and so on. Destroy releases all interfaces to the console such as IConsole and IConsoleNamespace. You should be aware that MMC remains in a state in which everything can be queried during the call to Destroy so the snap-in can get information from the console. On return from Destroy, however, data integrity cannot be guaranteed.

QueryDataObject is used to get a data object for a specific cookie, including the static folder (NULL cookie). The data object type is taken from the DATA_OBJECT_TYPES enumeration and is used to determine the context in which someone is asking for the data object. A CCT_SCOPE flag is set to indicate that the data object is for the scope pane. CCT_RESULT is set to indicate it is for the result view pane, and another, CCT_SNAPIN_MANAGER, indicates when the snap-in manager is being used. Another constant, CCT_UNITIALIZED indicates that the data object has an invalid type. Given context information, the snap-in can determine the context in which it is being asked for a data object.

For example, when inserting a snap-in into the scope pane using the snap-in manager (CCT_SNAPIN_MANAGER), the snap-in may use one set of property pages on the static node (folder). After it has been inserted into the scope pane, the user may issue a Properties request on the folder. A request for a data object must be made. The context type CCT_SCOPE is used, giving the same snap-in the option of displaying different property sheets. This behavior is not required, but the console provides the information anyway.

As noted earlier, IConsole is the snap-in's interface to the console, and objects that expose the IDataObject interface are used to pass context information from the snap-in to the console or between snap-ins. IDataObject is documented in the Platform SDK.

The GetDisplayInfo method retrieves display information for a namespace item in the scope pane. This is similar to the Win32 callback mode for the tree-view control. CompareObjects provides a way for a snap-in component to compare two data objects and determine whether they refer to the same physical object. This method is used for detecting duplicate property sheets. The snap-in must compare the two managed objects.