Displaying Running Text in a List Box
Submitted by date of submission user level
Mahesh Chand July 10, 2000 Beginner
Add a list box on a dialog, and add a member variable using Class View.
DDX_Control(pDX, IDC_LIST1, m_LogList1);
Create AddText function.
void MyProgress::AddText(CString szLog)
{
if ( m_LogList1.GetCount() > 8 )
m_LogList1.DeleteString(0);
m_LogList1.AddString(szLog);
m_LogList1.UpdateWindow();
}
Now it depends how many lines do you want to display in your text box. Say 8 lines. Call AddText function when you want to add a new text to the list box. For example,
CString str = "Mahesh testing";
AddText(str);