본문 바로가기
프로그래밍/C, C++

MFC - 리스트컨트롤(CListCtrl) 대용량 데이터 처리

by 꾸션 2015. 2. 3.

리스트 컨트롤에서 대용량의 데이터를 업데이트 하는 방법에 대해서 알아보겠습니다.
CListCtrl클래스의 SetItemCount(), SetItemCountEx()함수를 사용하면 되는데, 사용 방법은 업데이트 할 데이터의 양을 먼저 위 두개의 함수를 사용하여 알려주고, 데이터를 입력하기만 하면 됩니다.

아래는 각 각의 함수를 사용하는 방법이며, MSDN에서 발췌하였습니다.

 

CListCtrl::SetItemCount()

https://msdn.microsoft.com/en-us/library/88tba5s4.aspx

CString str;

// Add 1024 items to the list view control.
m_myListCtrl.SetItemCount(1024);

for (int i = 0; i < 1024; i++)
{
  str.Format(TEXT("item %d"), i);
  m_myListCtrl.InsertItem(i, str);
}

CListCtrl::SetItemCountEx()

 

CListCtrl::SetItemCountEx()

https://msdn.microsoft.com/en-us/library/xb95w29a.aspx

CString str;

// Add 1024 items to the list view control. 

// Force my virtual list view control to allocate  
// enough memory for my 1024 items.
m_myVirtualListCtrl.SetItemCountEx(1024, LVSICF_NOSCROLL|LVSICF_NOINVALIDATEALL);

for (int i = 0; i < 1024; i++)
{
  str.Format(TEXT("item %d"), i);
  m_myVirtualListCtrl.InsertItem(i, str);
}

 

반응형

댓글