ClistCtrl 中如何返回当前选中的一个Item?

解决方案 »

  1.   

    int nItem = -1; POSITION pos = m_AgainList.GetFirstSelectedItemPosition(); if(pos != NULL)
    {
    nItem = m_AgainList.GetNextSelectedItem(pos);
    }
      

  2.   

    我的意思是单击或双击一项,返回相应的Item.
      

  3.   

    GetItemText
    GetItemData
    GetItem
      

  4.   

    CListCtrl::GetSelectionMark
    This method retrieves the selection  from a list view control. This method implements the behavior of the Windows CE macro LISTVIEW_GETSELECTIONMARK. You can use this macro or explicitly send the LVM_GETSELECTIONMARK message.int GetSelectionMark( ); 
      

  5.   

    int GetItemText( int nItem, int nSubItem, LPTSTR lpszText, int nLen ) const
    GetItemData( int nItem ) const;
    我现在要的就是 nItem得值。
      

  6.   

    int GetSelectionMark( );Return Value
    The zero-based selection , or -1 if there is no selection .如何得到nItem
      

  7.   

    int nItem = -1; POSITION pos = m_AgainList.GetFirstSelectedItemPosition(); if(pos != NULL)
    {
    nItem = m_AgainList.GetNextSelectedItem(pos);
    }
    -----------------------
    这里不是有了吗?
    你选中一个就有一个,选种多了,改改代码把if改成while不就行了?
      

  8.   

    CListCtrl listctrl;
    int i=listctrl.GetSelectionMark