Partager via


Working with IConsole

Every instance of a snap-in that exists in the scope pane is unique, and the methods of the IConsole interface preserve that uniqueness. You use the SetHeader and SetToolbar methods to associate the IHeaderCtrl2 and IToolbar interfaces with the snap-in's instance of IConsole and to provide column headers and toolbars associated with the result pane. You can use the QueryResultView method to get a pointer to an IUnknown interface to the result pane control only if your view is a custom OCX. This is the way to get the pointer to the OCX's IDispatch interface.

The QueryScopeImageList and QueryResultImageList methods allow you to get interface pointers to the image lists that the console provides for inserting icons in the scope and result pane. The QueryConsoleVerb method allows the snap-in to incorporate the functionality of standard verbs such as cut, copy, and paste, while the SelectScopeItem method is used to programmatically select a scope item in the scope pane. The UpdateAllViews method generates a notification to update one or more views because the content has changed. You can obtain a handle to the main frame window by using the GetMainWindow method. The remaining IConsole method is MessageBox, which the snap-in uses to provide information to the user.

The IConsole2 interface is a newer version of the IConsole interface and is introduced in MMC version 1.1. IConsole2 contains all the methods of IConsole, as well as three additional ones. The Expand method enables the snap-in to expand or collapse an item in the scope pane. The IsTaskpadViewPreferred method determines whether the user prefers taskpad views by default. Finally, the SetStatusText method enables the snap-in to change the text in the status bar.

A pointer to the IConsole2 interface is passed to the snap-in through IComponent::Initialize and IComponentData::Initialize. Each IComponent and IComponentData object gets its own private IConsole2 interface pointer.

When using the IConsole2 interface for manipulating the result pane and result items, you should use the IConsole2 interface pointer passed to the snap-in's IComponent implementation that owns the view. When using IConsole2 for manipulating the scope pane and scope items, use the IConsole2 interface pointer passed to the snap-in's IComponentData implementation.

Working with IComponentData

Working with IComponent

Working with IDataObject

Registering and Unregistering a Snap-in