我把它设成Extended,即可以用shift或ctrl多选,在选中以后,我想得到每个选中的Item的字符串,应该怎么办?好像没有直接的函数可以用啊。。。
thx! 问题点数:20、回复次数:6Top
1 楼jingjing8178(晶晶)回复于 2002-12-03 01:00:38 得分 20
int CListBox::GetSelItems(int nMaxItems,LPINT rgIndex ) const;
Example:
extern CListBox* pmyListBox;
int nCount = pmyListBox->GetSelCount();
CArray<int,int> aryListBoxSel;
aryListBoxSel.SetSize(nCount);
pmyListBox->GetSelItems(nCount, aryListBoxSel.GetData());
CString str;
for(int i=0; i < aryListBoxSel->GetUpperBound(); i++)
{
pmyListBox->GetText(aryListBoxSel[i], str);
AfxMessageBox(str);
}