CComboBox::GetCurSel int GetCurSel( ) const;Return ValueThe zero-based index of the currently selected item in the list box of a combo box, or CB_ERR if no item is selected.ResCall this member function to determine which item in the combo box is selected. GetCurSel returns an index into the list.Example// The pointer to my combo box. extern CComboBox* pmyComboBox;// Select the next item of the currently selected item // in the combo box. int nIndex = pmyComboBox->GetCurSel(); int nCount = pmyComboBox->GetCount(); if ((nIndex != LB_ERR) && (nCount > 1)) { if (++nIndex < nCount) pmyComboBox->SetCurSel(nIndex); else pmyComboBox->SetCurSel(0); }要里面的text的话配合下面的函数 int GetLBText( int nIndex, LPTSTR lpszText ) const;void GetLBText( int nIndex, CString& rString ) const;
int GetCurSel( ) const;Return ValueThe zero-based index of the currently selected item in the list box of a combo box, or CB_ERR if no item is selected.ResCall this member function to determine which item in the combo box is selected. GetCurSel returns an index into the list.Example// The pointer to my combo box.
extern CComboBox* pmyComboBox;// Select the next item of the currently selected item
// in the combo box.
int nIndex = pmyComboBox->GetCurSel();
int nCount = pmyComboBox->GetCount();
if ((nIndex != LB_ERR) && (nCount > 1))
{
if (++nIndex < nCount)
pmyComboBox->SetCurSel(nIndex);
else
pmyComboBox->SetCurSel(0);
}要里面的text的话配合下面的函数
int GetLBText( int nIndex, LPTSTR lpszText ) const;void GetLBText( int nIndex, CString& rString ) const;
m_ComboBox.GetLBText(m_ComboBox.GetCurSel(),sReture);