I am writing a MFC application and need to have the program pause for a few seconds. I am trying to use the OnTimer event and am having troubles. The following code causes the program to freeze and stop responding
m_iCount = 0;
SetTimer(ID_TEST_TIMER, 1000, NULL);
while(m_iCount <= 5)
{
}
However if I add the following it works fine.
m_iCount = 0;
SetTimer(ID_TEST_TIMER, 1000, NULL);
while(m_iCount <= 5)
{
CString x;
x.Format("%d",m_iCount);
MessageBox(x);
}
In both of these examples the program is suppose to wait 5 seconds before continuing. Also note that m_iCount is suppose to incrament everytime the ID_TEST_TIMER event is called. Any suggestions on what I am doing wrong and can do to fix it?