You can use GetTickCount() to return a long integer containing the number of milliseconds the system has been running. If you check the difference between the current time and a start time you can wait until a second has passed, independant of how long the code in your loop takes to execute (assuming it doesn't take more than 1 second). You can do it like this:
Code:long LastTime = GetTickCount(); for(int i=5; i>0; i--) { // Do something while(GetTickCount() < LastTime + 1000); // Pause for 1 second LastTime = GetTickCount(); }




Reply With Quote