up是呀是呀,这MSDN上的例子也很清楚:Example// The pointer to my combo box. extern CComboBox* pmyComboBox;// Dump all of the items in the combo box. #ifdef _DEBUG CString str, str2; int n; for (int i=0;i < pmyComboBox->GetCount();i++) { n = pmyComboBox->GetLBTextLen( i ); pmyComboBox->GetLBText( i, str.GetBuffer(n) ); str.ReleaseBuffer(); str2.Format(_T("item %d: %s\r\n"), i, str.GetBuffer(0)); afxDump << str2; } #endif你看看这不所有的都有了:)
m_ComboCtrl.GetLBText(nIndex,m_Str);//m_Str中存放结果
CString str;
m_ComboCtrl.GetWindowText(Str);
或者:
char str[nMaxCount];//具体长度自己定
m_ComboCtrl.GetWindowText(Str,nMaxCount);
extern CComboBox* pmyComboBox;// Dump all of the items in the combo box.
#ifdef _DEBUG
CString str, str2;
int n;
for (int i=0;i < pmyComboBox->GetCount();i++)
{
n = pmyComboBox->GetLBTextLen( i );
pmyComboBox->GetLBText( i, str.GetBuffer(n) );
str.ReleaseBuffer(); str2.Format(_T("item %d: %s\r\n"), i, str.GetBuffer(0));
afxDump << str2;
}
#endif你看看这不所有的都有了:)
GetLBText(((CComboBox*)(GetDlgItem(IDC_COMBO1)))->GetCurSel(), str);