Using List Views
The default result pane view type is a list view. A list view displays a collection of items, each consisting of an icon and a label, and provides several ways to display and arrange the items. For example, additional information about each item can be displayed in columns to the right of the icon and label.
MMC implements list views using a list-view control. The control supports a number of view type modes, and the user can choose a mode by selecting a scope item and clicking View on the context menu. Be aware that snap-ins can programmatically set all view type modes.
Many of the features associated with list views are provided by MMC interfaces. For example, IResultData allows snap-ins to manipulate items and the view style associated with the list view. IResultData methods include InsertItem and DeleteItem, which are used by snap-ins to insert or delete single items in the result pane. DeleteAllRsltItems allows deletion of all items in the pane. Snap-ins can find items or subitems by using FindItemByLParam. Single items can be set or retrieved using SetItem and GetItem. The next item can be retrieved by using GetNextItem. The view mode can be set or retrieved by using SetViewMode and GetViewMode. The state of a particular item can be modified with ModifyItemState and the result pane's view style can be set with ModifyViewStyle. Snap-ins can sort all items in the result pane with Sort and, after changing an item being displayed, update the item using UpdateItem. The text for the result pane's description bar can be set by using SetDescBarText.
The IConsoleVerb interface allows snap-ins to enable standard verbs including cut, copy, paste, delete, properties, rename, refresh, and print. SetVerbState enables a snap-in to set a given verb's button state, while GetVerbState is used to retrieve a verb's button state. The SetDefaultVerb and GetDefaultVerb methods allow a snap-in to set and retrieve the default action on an object.
IHeaderCtrl2 methods manipulate the number of columns and their text labels for the list view. With InsertColumn, a snap-in can add a column to a list view; with DeleteColumn it can remove one. You can set the width of a column with SetColumnWidth and retrieve the current width with GetColumnWidth. The SetColumnText method is available to set text in a specified column, and GetColumnText to retrieve current text.
Other IHeaderCtrl2 methods include SetChangeTimeOut, SetColumnFilter, and GetColumnFilter. These methods provide support for users to filter list views based on filters set on each column in the result view.
The IColumnData interface allows snap-ins to access column configuration data that MMC persists in memory when the user customizes list view columns. Specifically, the user can:
- Change the width of a column.
- Reorder columns.
- Hide or display columns.
- Sort columns.
GetColumnConfigData enables a snap-in to retrieve the current width, order, and hidden status of a set of columns in a list view. SetColumnConfigData allows the snap-in to set this information. The GetColumnSortData and SetColumnSortData methods allow a snap-in to retrieve and set the sorted column and sorting direction for a column set.
With the IImageList interface, the snap-in can insert images to be used as icons for items in the result pane. ImageListSetIcon is used to set an icon in an image list, and ImageListSetStrip enables a snap-in to set a strip of icons in an image list.
The RESULTDATAITEM structure is used frequently to accomplish much of the work associated with the result pane.
For more information, see:
- Using List Views: Interfaces
- Using List Views: Implementation Details
- Owner Data/Virtual Lists
- Exporting List Views to a File
- Dynamically Updating List Views