Causes the list-view control to allocate memory for the specified number of items or sets the virtual number of items in a virtual list-view control.



Number of items that the list-view control will ultimately contain.


Version 4.70. Values that specify the behavior of the list-view control after resetting the item count. This value can be a combination of the following:

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

Return value

Returns nonzero if successful, or zero otherwise.


How the memory is allocated depends on how the list-view control was created. You can send this message explicitly or use the ListView_SetItemCount or ListView_SetItemCountEx macros. For more information, see Virtual List-View Style.

If the list-view control was created without the LVS_OWNERDATA style, sending this message causes the control to allocate its internal data structures for the specified number of items. This prevents the control from having to allocate the data structures every time an item is added.

If the list-view control was created with the LVS_OWNERDATA style (a virtual list view), sending this message sets the virtual number of items that the control contains.

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

When the common control list-view is a virtualized list-view (LVS_OWNERDATA), there is a 100,000,000 item limit on the list-view. In this scenario, LVM_SETITEMCOUNT will return FALSE when it has a wParam of 100,000,001.


Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]