I've got a nice little button:
void CTest2Dlg::OnButton1()
{
MyThread newThread(&m_SerialText, &m_SerialTextControl, this);
newThread.CreateNewThread();
}
m_SerialText is a variable connected to an Edit Box.
m_SerialTextControl is a control variable to the Edit box.
In the CreateNewThread I do the following
m_SerialText->Insert(m_SerialText->GetLength(), "nice thread");
m_SerialText->Insert(m_SerialText->GetLength(), "\r\n");
m_SerialTextControl->UpdateWindow();
This does not work exacltly the way I want it to work. The edit box text is not updated until the thread is finished.
I've tried to add m_SerialTextControl->UpdateData(FALSE); but then the program craches.
How do you update a text in an edit box from a thread?



LinkBack URL
About LinkBacks


