1 void CGlassDetectDlg::OnBnClickedButton14() 2 { 3 // TODO: Add your control notification handler code here 4 5 6 7 CString str; 8 POSITION pos=m_List.GetFirstSelectedItemPosition(); //pos选中的首行位置 9 if(pos==NULL) 10 AfxMessageBox("no item were selected!"); 11 else 12 { 13 while(pos) //如果你选择多行 14 { 15 int nIdx=-1; 16 nIdx= m_List.GetNextSelectedItem(pos); 17 18 if(nIdx >=0&&nIdx<m_List.GetItemCount()) 19 { 20 str =m_List.GetItemText(nIdx,4);//获取指定列,为字符串形式 21 } 22 } 23 } 24 }