CListCtrl::GetNextSelectedItem
Visual Studio 2005
Gets the index of the list item identified by pos, then sets pos to the POSITION value.
int GetNextSelectedItem( POSITION& pos ) const;
Parameters
- pos
-
A reference to a POSITION value returned by a previous call to GetNextSelectedItem or GetFirstSelectedItemPosition. The value is updated to the next position by this call.
The following code sample demonstrates the usage of this function.
CListCtrl* pListCtrl = (CListCtrl*) GetDlgItem(IDC_YOURLISTCONTROL);
ASSERT(pListCtrl != NULL);
POSITION pos = pList->GetFirstSelectedItemPosition();
if (pos == NULL)
TRACE0("No items were selected!\n");
else
{
while (pos)
{
int nItem = pList->GetNextSelectedItem(pos);
TRACE1("Item %d was selected!\n", nItem);
// you could do your own processing on nItem here
}
}