If you design a class called HourGlass or SandTimer, there are a couple of approaches. You could have it post messages to windows or threads or have it be as simple as
void HourGlass::StartTimer()
{
m_startTime = GetTickCount();
}
DWORD HourGlass::GetElapsedTime() // in milliseconds
{
if(m_startTime)
{
return GetTickCount()-m_startTime;
}
return 0;
}
void HourGlass::StopTimer()
{
m_startTime = 0;
}
That is the basic gist of it. You can expand it to post messages and have a timeout. That would required it to run a thread until the time has elapsed. Once it has elapsed, you can post messages to windows/threads that registered themselves with it.
Matt