I've read the documentation link and several threads explaining how to make a timer. Now after hours I still can't get my test to work.
In the testDlg.h header I declare:
UINT_PTR m_uTimerId;
CString textControl1; // Controls an Edit Control
afx_msg void OnBnClickedButton1();
afx_msg void OnTimer(UINT_PTR nIDEvent);
int myX;
myX is initialized to 0 in the dialog constructor. The button clicked function looks like this:
void CtestDlg::OnBnClickedButton1()
{
textControl1 = _T("New text");
UpdateData(FALSE);
m_uTimerId = SetTimer(1,3000,NULL);
}
And here is OnTimer:
void CtestDlg::OnTimer(UINT_PTR nIDEvent)
{
myX++;
if(myX % 2 == 0)
textControl1 = _T("timer is");
else
textControl1 = _T("working");
UpdateData(FALSE);
}
When I click the associated button, text in edit control updates to "New text", but the timer function is not working, because the text does not change after time elapses.
Any help would be GREATLY appreciated. I promise you!