I want to continuously update status information in the edit box. Below is a sample program:
(void)CTestDlg::OnTestButton()
{
int i;
time_t first, second;
m_ReceivedString = "Testing...";
UpdateData(FALSE);
(void)time(&first);
(void)time(&second);
while(difftime(second, first) < 2.0) // 2 seconds delay
(void)time(&second);
for(i=0; i<5; i++)
{
if(i==0)
{
m_ReceivedString = "Zero";
UpdateData(FALSE);
}
if(i==1)
{
m_ReceivedString = "One";
UpdateData(FALSE);
}
if(i==2)
{
m_ReceivedString = "Two";
UpdateData(FALSE);
}
if(i==3)
{
m_ReceivedString = "Three";
UpdateData(FALSE);
}
if(i==4)
{
m_ReceivedString = "Four";
UpdateData(FALSE);
}
(void)time(&first);
(void)time(&second);
while(difftime(second,first) < 2.0) // 2 sec delay
(void)time(&second);
}
}
When running this program,
I wanted the following to be displayed in the edit box:
Testing...
followed by
One
followed by
Two
followed by
Three
followed by
Four
When running the program, only the last line
Four
is displayed.
What needs to be done to get all 5 lines to be displayed
one after the other?
(void)CTestDlg::OnTestButton()
{
int i;
time_t first, second;
m_ReceivedString = "Testing...";
UpdateData(FALSE);
(void)time(&first);
(void)time(&second);
while(difftime(second, first) < 2.0) // 2 seconds delay
(void)time(&second);
for(i=0; i<5; i++)
{
if(i==0)
{
m_ReceivedString = "Zero";
UpdateData(FALSE);
}
if(i==1)
{
m_ReceivedString = "One";
UpdateData(FALSE);
}
if(i==2)
{
m_ReceivedString = "Two";
UpdateData(FALSE);
}
if(i==3)
{
m_ReceivedString = "Three";
UpdateData(FALSE);
}
if(i==4)
{
m_ReceivedString = "Four";
UpdateData(FALSE);
}
(void)time(&first);
(void)time(&second);
while(difftime(second,first) < 2.0) // 2 sec delay
(void)time(&second);
}
}
When running this program,
I wanted the following to be displayed in the edit box:
Testing...
followed by
One
followed by
Two
followed by
Three
followed by
Four
When running the program, only the last line
Four
is displayed.
What needs to be done to get all 5 lines to be displayed
one after the other?