I'm trying to learn threads so I created a simple dialog based MFC app
with an edit box, a Run button and an Exit button. Run starts a loop
that continually updates the edit control. How do I modify the code so
that the dialog responds to events? That is, so the Exit button will
work. Do I even need threads in this situation?
void CThreadPractice Dlg::OnBnClicke dRun()
{
int i = 0;
while (1) {
if (i >= 10) {
i = 0;
}
char intString[2];
_itoa(i,intStri ng,10);
CString msg = CString(intStri ng);
m_edit1.SetWind owTextW(msg);
i++;
Sleep(500);
}
}
void CThreadPractice Dlg::OnBnClicke dExit()
{
exit(0);
}
----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---
with an edit box, a Run button and an Exit button. Run starts a loop
that continually updates the edit control. How do I modify the code so
that the dialog responds to events? That is, so the Exit button will
work. Do I even need threads in this situation?
void CThreadPractice Dlg::OnBnClicke dRun()
{
int i = 0;
while (1) {
if (i >= 10) {
i = 0;
}
char intString[2];
_itoa(i,intStri ng,10);
CString msg = CString(intStri ng);
m_edit1.SetWind owTextW(msg);
i++;
Sleep(500);
}
}
void CThreadPractice Dlg::OnBnClicke dExit()
{
exit(0);
}
----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---
Comment