Need timer help to execute routine. 
Author Message
 Need timer help to execute routine.

Ref VC6.0

I need to create a timer to call a routine every so many seconds. Also, need
to stop and start the timer again when it enters the routine. My application
is just a win32 console app.

I don't have any ideas where to look. I couldn't even find anything on a
timer control.

A good C src example would be great to show me how.

Thanks,
Jt



Fri, 18 Feb 2005 09:39:39 GMT  
 Need timer help to execute routine.
Jt,

If you timer needs are fairly low priority, then you may want to consider
creating a hidden window, implementing the msg pump, and use the
SetTimer/KillTimer API calls and the WM_TIMER message.  Note - you don't have to
explicitly respond to the WM_TIMER message - you can use a callback -- see the
documentation on the Windows API SetTimer function.

If you need more precision, have a look at multimedia timers.  Consider the
following link:

http://msdn.microsoft.com/library/en-us/dllproc/base/using_waitable_t...
s.asp

best regards
roy fine


Quote:
> Ref VC6.0

> I need to create a timer to call a routine every so many seconds. Also, need
> to stop and start the timer again when it enters the routine. My application
> is just a win32 console app.

> I don't have any ideas where to look. I couldn't even find anything on a
> timer control.

> A good C src example would be great to show me how.

> Thanks,
> Jt



Fri, 18 Feb 2005 10:48:22 GMT  
 Need timer help to execute routine.

Quote:
> I need to create a timer to call a routine every so many seconds. Also,
need
> to stop and start the timer again when it enters the routine. My
application
> is just a win32 console app.

What do you want to do while waiting? If the answer is nothing then this
will do you:

    while ( yourTimerIsActive )
    {
        Sleep(2000);
        YourPeriodicFunction(yourArgumentList);
    }

If you want to do something in the foreground you can run that code in a
secondary thread. Check the docs for _beginthreadex().

If you want to use Win32 timer services, check the docs for
timeBeginPeriod() or CreateWaitableTimer().

Regards,
Will



Fri, 18 Feb 2005 13:10:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP: VC++ 4.2 need reliable millisecond timer routine

2. Need help with timer function

3. Need Help Executing Program (suggestions from group added but not quite there yet)

4. Old Timer Needs Help..

5. Need help with Execute method of Command object

6. 1st timer, need help w/ vc++ 5.0

7. Need help with multimedia timers

8. need little help regarding threads, timer etc.

9. Need Help About TIMER, Please....

10. Need Help About TIMER, Please....

11. need help on Timer (SetTimer, KillTimer)

12. Need help with interrupt routines in C.

 

 
Powered by phpBB® Forum Software