怎么得到listBox当前选择的项啊 就是得到当前选择的字符串

解决方案 »

  1.   

    CListBox::GetText 
    int GetText( int nIndex, LPTSTR lpszBuffer ) const;void GetText( int nIndex, CString& rString ) const;
    CListBox myBox;
    int idx = myBox.GetCurSel();
    CString sInfo;
    myBox.GetText(idx,sInfo);
      

  2.   

    CListBox* pmyListBox;
    //......
    // Select the next item of the currently selected one.
    int nIndex = pmyListBox->GetCurSel();
    CString strText;
    int n = pmyListBox->GetTextLen( nIndex  );
    pmyListBox->GetText( i, strText.GetBuffer(n) );//结果在strText中