CComboBox::GetLBText

콤보 상자의 목록 상자에서 문자열을 가져옵니다.

int GetLBText( 
   int nIndex, 
   LPTSTR lpszText  
) const; 
void GetLBText( 
   int nIndex, 
   CString& rString  
) const;

매개 변수

  • nIndex
    복사할 수 목록 상자 문자열의 인덱스를 포함 합니다.

  • lpszText
    문자열을 받을 버퍼에 가리킵니다. 버퍼에 문자열 및 null 종결 문자에 대 한 충분 한 공간이 있어야 합니다.

  • rString
    CString에 대한 참조입니다.

반환 값

바이트 단위로 종료 null 문자를 제외한 문자열의 길이입니다. 경우 nIndex 올바른 인덱스를 지정 하지 않은 반환 값이 CB_ERR.

설명

이 멤버의 두 번째 양식 채우기 함수는 CString 항목의 텍스트와 함께 개체입니다.

예제

// Dump all of the items in the combo box.
CString str1, str2;
int n;
for (int i = 0; i < m_pComboBox->GetCount(); i++)
{
   n = m_pComboBox->GetLBTextLen(i);
   m_pComboBox->GetLBText(i, str1.GetBuffer(n));
   str1.ReleaseBuffer();

   str2.Format(_T("item %d: %s\r\n"), i, str1.GetBuffer(0));
   AFXDUMP(str2);
}

요구 사항

헤더: afxwin.h

참고 항목

참조

CComboBox 클래스

계층 구조 차트

CComboBox::GetLBTextLen

CB_GETLBTEXT