Share via


CListCtrl::SetItemCountEx

Sets the item count for a virtual list view control.

BOOL SetItemCountEx( 
   int iCount, 
   DWORD dwFlags = LVSICF_NOINVALIDATEALL  
);

Parameters

  • iCount
    Number of items that the control will ultimately contain.

  • dwFlags
    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.

Return Value

Nonzero if successful; otherwise zero.

Remarks

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.

Example

     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|
            LVSICF_NOINVALIDATEALL);

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

Requirements

Header: afxcmn.h

See Also

Reference

CListCtrl Class

Hierarchy Chart

CListCtrl::SetItemCount