CComboBox::GetCurSel

선택 된 콤보 상자에서 항목을 확인 하려면이 멤버 함수를 호출 합니다.

int GetCurSel( ) const;

반환 값

콤보 상자의 목록 상자에서 현재 선택한 항목의 인덱스 또는 CB_ERR 항목이 선택 된 경우.

설명

GetCurSel목록에는 인덱스를 반환합니다.

예제

// Select the next item of the currently selected item  
// in the combo box. 
int nIndex = m_pComboBox->GetCurSel();
int nCount = m_pComboBox->GetCount();
if ((nIndex != CB_ERR) && (nCount > 1))
{
   if (++nIndex < nCount)
      m_pComboBox->SetCurSel(nIndex);
   else
      m_pComboBox->SetCurSel(0);
}

요구 사항

헤더: afxwin.h

참고 항목

참조

CComboBox 클래스

계층 구조 차트

CComboBox::SetCurSel

CB_GETCURSEL