请问如何获得CListCtrl控件当前选中的项的索引

解决方案 »

  1.   

    CListCtrl::GetItemPosition
    BOOL GetItemPosition( int nItem, LPPOINT lpPoint ) const;Return ValueNonzero if successful; otherwise zero.ParametersnItemThe index of the item whose position is to be retrieved.lpPointAddress of aPOINT structure that receives the position of the item鈥檚 upper-left corner, in view coordinates.ResRetrieves the position of a list view item.
      

  2.   

    POSITION pos=m_ListCtrl.GetFirstSelectedItemPosition();
    int nIndex;
    nIndex=m_ListCtrl.GetNextSelectedItem(pos);
    m_ListCtrl 为ListCtrl对象