LVM_SETCOLUMNWIDTH message

Changes the width of a column in report-view mode or the width of all columns in list-view mode. You can send this message explicitly or use the ListView_SetColumnWidth macro.

Parameters

wParam

Zero-based index of a valid column. For list-view mode, this parameter must be set to zero.

lParam

New width of the column, in pixels. For report-view mode, the following special values are supported:

Value Meaning
LVSCW_AUTOSIZE
Automatically sizes the column.
LVSCW_AUTOSIZE_USEHEADER
Automatically sizes the column to fit the header text. If you use this value with the last column, its width is set to fill the remaining width of the list-view control.

Return value

Returns TRUE if successful, or FALSE otherwise.

Remarks

Assume that you have a 2-column list-view control with a width of 500 pixels. If the width of column zero is set to 200 pixels, and you send this message with wParam = 1 and lParam = LVSCW_AUTOSIZE_USEHEADER, the second (and last) column will be 300 pixels wide.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Commctrl.h