I usually create my own listbox control be inherting
from MFC's CListBox.
i.e.,
class CMyListBox : public CListBox
and then add member called something like "LogLine", which
adds a string the end of the listbox scrolls to bottom of
the list box using SendMessage(WM_VSCROLL, SB_BOTTOM, 0).
NB: Make sure the listbox doesn't have the "Sort" property
enabled.
The code also includes a cleanup loop, that deletes from
the top of the listbox when it gets too full.
i.e.,
#define _MYLISTBOX_MAX_SIZE (500)
...
void CMyListBox::LogLine(LPCTSTR lpLog)
{
// Make sure list box never grows too big
while(GetCount() > _MYLISTBOX_MAX_SIZE)
DeleteString(0);
// Append the new string to the list box
AddString(lpLog);
// Scroll to the bottom of the list box
SendMessage(WM_VSCROLL, SB_BOTTOM, 0);
}
I hope this is useful. I think this is what you were
asking about?