现在的问题是,我在列表框中把一个文件夹的文件全都显示出来了,现在想选择一个文件把它删掉.
想用 for (int i=m_list.GetCount()-1;i>-1;i--)
{
if(m_list.GetSel(i))
{   
                     m_file=m_list.GetCaretIndex(i);
// m_list.DeleteString(i);
  DeleteFile(m_file);
}
}
GetCaretIndex是得到选择文件的路径,在用deletefile把它删掉,可是编译时提示error C2660: 'GetCaretIndex' : function does not take 1 parameters.请问我错在哪里??

解决方案 »

  1.   

    用法错误,应该是得到当前选择的项,然后再得到它的文本,然后 删除.
    CListBox::GetCaretIndex 
    int GetCaretIndex( ) const;Return ValueThe zero-based index of the item that has the focus rectangle in a list box. If the list box is a single-selection list box, the return value is the index of the item that is selected, if any.ResAn application calls the GetCaretIndex member function to determine the index of the item that has the focus rectangle in a multiple-selection list box. The item may or may not be selected.
      

  2.   

    void GetText( int nIndex, CString& rString ) const;
    可以根据索引,得到文本,我想这个文本就是文件名吧.
      

  3.   

    为什么我用GetText时会出现error C2065: 'GetText' : undeclared identifier
      

  4.   

    你在前面加上M_LIST.就可以了.