This documentation is archived and is not being maintained.


Sets the item count for a virtual list view control.

BOOL SetItemCountEx( 
   int iCount, 


Number of items that the control will ultimately contain.


Specifies the behavior of the list view control after resetting the item count. This value can be a combination of the following:

  • LVSICF_NOINVALIDATEALL   The list view control will not repaint unless affected items are currently in view. This is the default value.

  • LVSICF_NOSCROLL   The list view control will not change the scroll position when the item count changes.

Nonzero if successful; otherwise zero.

This member function implements the behavior of the Win32 macro, ListView_SetItemCountEx, as described in the Windows SDK and should only be called for virtual list views.

		CString str;

		// Add 1024 items to the list view control. 

		// Force my virtual list view control to allocate  
		// enough memory for my 1024 items.
		m_myVirtualListCtrl.SetItemCountEx(1024, LVSICF_NOSCROLL|

		for (int i = 0; i < 1024; i++)
			str.Format(TEXT("item %d"), i);
			m_myVirtualListCtrl.InsertItem(i, str);

Header: afxcmn.h