| | |
MFC Countdown Timer
Thread Solved |
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
However if I add the following it works fine.
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?
c Syntax (Toggle Plain Text)
m_iCount = 0; SetTimer(ID_TEST_TIMER, 1000, NULL); while(m_iCount <= 5) { }
However if I add the following it works fine.
c Syntax (Toggle Plain Text)
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?
Thanx,
Atrus
Atrus
C Syntax (Toggle Plain Text)
while(m_iCount <= 5) { }
why are you making it so difficult ? If you goal is for the program to pause for 5 second, just call Sleep() function. No need for that timer.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Ok, so here's a spin off of the previous. If I wanted the user to only have say 20 seconds to enter text in an edit box before it grayed out, how would I go about that? causes the program to pause, so what would I use?
c Syntax (Toggle Plain Text)
Sleep()
Thanx,
Atrus
Atrus
•
•
•
•
Ok, so here's a spin off of the previous. If I wanted the user to only have say 20 seconds to enter text in an edit box before it grayed out, how would I go about that?causes the program to pause, so what would I use?c Syntax (Toggle Plain Text)
Sleep()
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Tkinter Countdown Timer problems. (Python)
- Pause/Restart Countdown Timer Question (VB.NET)
- Countdown Timer (VB.NET)
Other Threads in the C Forum
- Previous Thread: DefWindowProc
- Next Thread: Calling C function from MATLAB
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic feet fflush fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking highest histogram homework i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft mqqueue mysql number odf owf pattern pdf performance pointer posix probleminc process program programming pyramidusingturboccodes radix recursion recv repetition research reversing scanf segmentationfault sequential shape socket socketprograming stack standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi






