Platform SDK: Management Console

IHeaderCtrl2::InsertColumn

The IHeaderCtrl2::InsertColumn method adds a column to a default result pane.

HRESULT InsertColumn(
  int nCol,       // zero-based index of the column
  LPCWSTR title,  // specifies the name of the column
  int nFormat,    // specifies justification of text
  int nWidth      // specifies the column's initial width
);
 

Parameters

nCol
[in] Zero-based index of the column being inserted.
title
[in] Specifies the string representing the title of the column being inserted.
nFormat
[in] Specifies the position of text within the column. For column zero, nFormat must be LVCFMT_LEFT. This value must be one of the following:
Value Meaning
LVCFMT_LEFT Text is left-aligned.
LVCFMT_CENTER Text is center-aligned.
LVCFMT_RIGHT Text is right-aligned.

nWidth
[in] Specifies the width of the column in pixels. This value must be one of the following:
Value Meaning
MMCLV_AUTO MMC automatically determines the width of the column based on its title string.
HIDE_COLUMN Introduced in MMC 1.2. The column is inserted, but it is hidden. Note that the user can make the column visible when customizing a list view.

For snap-ins built with the MMC 1.2 SDK, but which are loaded in an older version of MMC, HIDE_COLUMN is interpreted as a zero width. The user can widen the column by dragging it with the mouse.


Return Values

S_OK
The column was successfully inserted.
E_UNEXPECTED
The current result view is not the console-provided default view.
E_INVALIDARG
The title parameter is NULL or empty (""), or nCol or nFormat is invalid.

Remarks

MMC does not persist in memory any changes made to a column set due to the action of IHeaderCtrl2::InsertColumn, so snap-ins are solely responsible for updating persisted column configuration data after inserting columns into a column set. See IHeaderCtrl2 and Column Persistence for more information.

Notes to Callers

Calls to InsertColumn fail if any items have already been inserted into the result view.

Requirements

  Version: Requires MMC 1.2 (with Internet Explorer 5 or later). Included with Windows 2000 or available as a redistributable for Windows 95/98 and Windows NT 4.0 SP4.
  Header: Declared in Mmc.h.
  Library: Use Mmc.lib.

See Also

IHeaderCtrl2, IHeaderCtrl2 and Column Persistence