LVM_SETITEMCOUNT

This message prepares a list view control for adding a large number of items. In a regular list view control, it causes the control to allocate memory for the specified number of items. In a virtual list view control, available in Windows CE versions 2.0 and later, it sets the number of virtual items in the control. You can send this message explicitly or use the ListView_SetItemCount or ListView_SetItemCountEx macros.

At a Glance

Header file: Commctrl.h
Windows CE versions: 1.0 and later (updated in 2.0)
Related macro: ListView_SetItemCount or ListView_SetItemCountEx

Syntax

LVM_SETITEMCOUNT wParam = (WPARAM) (int) cItems;
lParam = (LPARAM) dwFlags;

Parameters

cItems

Number of items that the list view control will ultimately contain

dwFlags

For Windows CE versions 1.0 and 1.01, set this value to 0.

For Windows CE versions 2.0 and later, this value specifies the behavior of the list view control after resetting the item count. This value can be a combination of the following:

Value Description
LVSICF_NOINVALIDATEALL The list view control will not repaint unless affected items are currently in view.
LVSICF_NOSCROLL The list view control will not change the scroll position when the item count changes.

Return Values

In Windows CE versions 1.0 and 1.01, this message has no return value.

In Windows CE versions 2.0 and later, nonzero indicates success. Zero indicates failure.

Remarks

Windows CE versions 2.0 and later support virtual list views, which you create using the LVS_OWNERDATA style. In a virtual list view, this function sets the number of items in the virtual list view, but does not allocate any memory.

The dwFlags parameter is intended only for list view controls that use the LVS_OWNERDATA and either LVS_REPORT or LVS_LIST styles.