CListBox::GetText
목록 상자에서 문자열을 가져옵니다.
int GetText(
int nIndex,
LPTSTR lpszBuffer
) const;
void GetText(
int nIndex,
CString& rString
) const;
매개 변수
nIndex
검색할 문자열의 인덱스를 지정 합니다.lpszBuffer
문자열을 받을 버퍼에 가리킵니다.버퍼에 문자열 및 null 종결 문자에 대 한 충분 한 공간이 있어야 합니다.호출 하 여 문자열의 크기를 미리 확인할 수 있습니다는 GetTextLen 멤버 함수입니다.rString
CString 개체에 대한 참조입니다.
반환 값
바이트 단위로 종료 null 문자를 제외한 문자열의 길이입니다.경우 nIndex 올바른 인덱스를 지정 하지 않은 반환 값이 LB_ERR.
설명
이 멤버의 두 번째 양식 채우기 함수는 CString 문자열 텍스트 개체.
예제
// Dump all of the items in the list box.
CString str, str2;
int n;
for (int i = 0; i < m_myListBox.GetCount(); i++)
{
n = m_myListBox.GetTextLen(i);
m_myListBox.GetText(i, str.GetBuffer(n));
str.ReleaseBuffer();
str2.Format(_T("item %d: %s\r\n"), i, str.GetBuffer(0));
AFXDUMP(str2);
}
요구 사항
헤더: afxwin.h