Who will read (and scroll through) 280,000 items?
A solution would be using a virtual list control that handles only the items actually visible. See
Virtual List Controls | Microsoft Docs[
^].
For a non virtual list control you can (and should always even with smaller lists) disable the screen update while modifying the list:
pTable->SetRedraw(FALSE);
pTable->SetRedraw(TRUE);
pTable->Invalidate();
pTable->UpdateWindow();
[EDIT]
When knowing the number of items in advance, use
SetItemCount()
initially. Even when not knowing the count in advance, it might be finally faster to determine and set it.
For further improvements make the code inside the loop as fast as possible (simple). That includes avoiding any function that allocates memory in the loop. Use for example preallocated
CString
s or plain text buffers defined outside the loop using the max. possible string length. If possible, avoid also any string formatting function.
[/EDIT]