Compartir a través de


Using Column Persistence: Implementation Details

This section includes information about how to add snap-in support for the CCF_COLUMN_SET_ID clipboard format and how to access column configuration data using the IColumnData interface.

To add snap-in support for CCF_COLUMN_SET_ID

  1. Add the CCF_COLUMN_SET_ID clipboard format to the snap-in's IDataObject implementation. Usually, IDataObject has its supported clipboard formats as static members. If so, add the CCF_COLUMN_SET_ID format as a member.

    static UINT s_cfColumnSetID;
    
  2. Register the CCF_COLUMN_SET_ID format and assign the registered format to the static member in the IDataObject implementation's constructor.

    s_cfColumnSetID = RegisterClipboardFormat (W2T(CCF_COLUMN_SET_ID));
    
  3. Include support for the CCF_COLUMN_SET_ID format in the snap-in's implementation of the IDataObject::GetData method.

Before using the IColumnData interface, review the topics Using IColumnData and IHeaderCtrl2 and Column Persistence.

To access column configuration data using IColumnData

  1. The IColumnData interface can be queried from the IConsole2 passed into IComponent::Initialize during the component's creation.
  2. To retrieve and set the current width, order, and hidden status of columns in a column set, use the GetColumnConfigData and SetColumnConfigData methods. To retrieve and set the sorted column and sorting direction for columns in a column set, use the GetColumnSortData and SetColumnSortData methods.
  3. When calling any of the IColumnData methods, fill an SColumnSetID structure to specify the ID of the column set on which the particular action is performed. If the snap-in does not support the CCF_COLUMN_SET_ID clipboard format, the column set ID is the node type GUID of the scope item that owns the list view. If the clipboard format is supported, the ID of the column set is the same one supplied to MMC in the snap-in's IDataObject::GetData implementation.

Using Column Persistence

Using Column Persistence: Interfaces

Using Column Persistence: Advanced Topics