如果我选了好几个,用什么函数菜可以读出来阿

解决方案 »

  1.   

    int buf[20];
    CString str;
    m_listbox.GetSelItems(m_listbox.GetSelCount(),buf);
    for(int i=0;i<m_listbox.GetSelCount();i++)
    {
    m_listbox.GetText(buf[i],str);
    MessageBox(str);
    }
      

  2.   

    // The pointer to my list box.
    extern CListBox* pmyListBox;// Get the indexes of all the selected items.
    int nCount = pmyListBox->GetSelCount();
    CArray<int,int> aryListBoxSel;aryListBoxSel.SetSize(nCount);
    pmyListBox->GetSelItems(nCount, aryListBoxSel.GetData()); ////////////////////////////////////////////////
    CArray里边就存的是你选中的item对应的index,拿出来处理就好