Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Retrieves the number of selected items in the list view control.

UINT GetSelectedCount( ) const;

The number of selected items in the list view control.

// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;

UINT i, uSelectedCount = pmyListCtrl->GetSelectedCount();
int  nItem = -1;

// Update all of the selected items.
if (uSelectedCount > 0)
   for (i=0;i < uSelectedCount;i++)
      nItem = pmyListCtrl->GetNextItem(nItem, LVNI_SELECTED);
      ASSERT(nItem != -1);

Community Additions

© 2015 Microsoft