scottmanjoe
Technical User
Hello,
How to get the index of the selected items of a CListCtrl Control Object.
GetSelectedCount() will give the number of selected items.
and GetNextItem() will give the next selected item(with the LVNI_SELECTED flag).
But i am not able to implement it and after one loop it gives a value -1 for the selected item.
int iCount = m_listServices.GetSelectedCount();
int nIndex = -1;
for(int i=0;i<iCount;i++)
{
nIndex = m_listServices.GetNextItem(nIndex, LVNI_SELECTED);
if(nIndex==-1)
break;
...//use iIndex to do something
}
Thanks,
Scott
How to get the index of the selected items of a CListCtrl Control Object.
GetSelectedCount() will give the number of selected items.
and GetNextItem() will give the next selected item(with the LVNI_SELECTED flag).
But i am not able to implement it and after one loop it gives a value -1 for the selected item.
int iCount = m_listServices.GetSelectedCount();
int nIndex = -1;
for(int i=0;i<iCount;i++)
{
nIndex = m_listServices.GetNextItem(nIndex, LVNI_SELECTED);
if(nIndex==-1)
break;
...//use iIndex to do something
}
Thanks,
Scott