Click to See Complete Forum and Search --> : Funktion use every 2 minutes (in a kind of loop) ? IMPORTAND ;]


PIN
May 24th, 1999, 08:54 PM
How can do a kind like >while (timer = twominutes); {my func}< without the tool (the rest of the programm) stand still ??

I heared about a CreateWaitTimer() but dont know to handle - or will be very happy about an example !!

Paul Burns
May 24th, 1999, 09:44 PM
use WM_TIMER message, like this...


// call this function to start the timer
void CSomeClass::OnTimerStart()
{
if (m_uTimerID)
return; // timer already running
m_uTimerID = SetTimer(1, 2 * 60 * 1000, NULL); // set timer for 2 mins.
}
// call this to stop it
void CSomeClass::OnTimerStop()
{
if (m_uTimerID)
KillTimer(m_uTimerID);
m_uTimerID = 0;
}
// this is the handler for WM_TIMER message, it will
// be called every 2 mins.
void CSomeClass::OnTimer(UINT nIDEvent)
{
// do something...
}

PIN
May 25th, 1999, 07:52 AM
Thaks alot hope it works transparent ! =) (Ill check it out now)

PIN
May 25th, 1999, 09:58 AM
I cant figure it out how to handle :(

Ive put your code in the xxFrame.cpp

and do the following ind xxFrame.h:

class CNuCFrame : public CStatic
{
public:
void OnTimerStart();
void OnTimerStop();
void OnTimer(UINT nIDEvent);


but I guess I miss somethink - cause nothink happend =)

could u help me again ? Or if u like an example project will be very nice !!