The IHeaderCtrl2::SetColumnWidth method sets the width, in pixels, of a specific column.
HRESULT SetColumnWidth( [in] int nCol, [in] int nWidth );
A zero-based index that specifies the location of the column relative to other columns in the result pane.
A value that specifies the width of the column. This value must be in pixels, or it can be the following value:
MMC automatically determines the width of the column based on the width of the text in the column title.
This method can return one of these values.
The width of the column was successfully set.
The current result view is not the console-provided default view.
The nCol parameter is invalid.
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).
Minimum supported client
Minimum supported server
Windows Server 2008