IHeaderCtrl2::SetColumnWidth method

The IHeaderCtrl2::SetColumnWidth method sets the width, in pixels, of a specific column.

Syntax

HRESULT SetColumnWidth(
  [in] int nCol,
  [in] int nWidth
);

Parameters

nCol [in]

A zero-based index that specifies the location of the column relative to other columns in the result pane.

nWidth [in]

A value that specifies the width of the column. This value must be in pixels, or it can be the following value:

MMCLV_AUTO

MMC automatically determines the width of the column based on the width of the text in the column title.

Return value

This method can return one of these values.

  • S_OK
    The width of the column was successfully set.

  • E_UNEXPECTED
    The current result view is not the console-provided default view.

  • E_INVALIDARG
    The nCol parameter is invalid.

Remarks

MMC does not persist in memory any changes made to a column set due to the action of IHeaderCtrl2::SetColumnWidth, so snap-ins must update persisted column configuration data after modifying the width of columns in a column set. For more information, see IHeaderCtrl2 and Column Persistence.

The HIDE_COLUMN flag for the nWidth parameter is not supported for SetColumnWidth. If the snap-in must hide the column, it must call IConsole2::SelectScopeItem to reselect the scope item and then in the resulting call to the snap-in's MMCN_SHOW notification handler, it must use nWidth=HIDE_COLUMN when inserting the column (in the call to IHeaderCtrl2::InsertColumn).

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Mmc.h

DLL

Mmcndmgr.dll

See also

IHeaderCtrl2

IHeaderCtrl2 and Column Persistence