LongTimer OCX

Download Now (about 1.5 MB) | Back to Hard & Software

The LongTimerIntervals OCX ActiveX control provides timer intervals much longer than the standard VB Timer. It has a significant additional advantage over the standard Timer.  The standard VB Timer depends on standard Windows’ timers.  Windows queues only a single timer message to an application.  If a previous message has not been processed when the next timer message would have been added to the message queue, no additional message is generated.  Thus, the standard Timer often runs “slow.”  The LongTimerIntervals OCX corrects this operation by calculating the actual expired time between timer messages using the Windows multimedia timer, and correcting subsequent events based on this actual time.  This OCX does not work in Excel.  Sorry about that!

Its properties and events are as follows:

Properties

Interval (Single) – Intervals are specified in seconds.  Thus, 1-hour = 3600, while 1-day = 86400.  The absolute limit on Interval is about 24 days (2,073,600 seconds).  The correction algorithm mentioned above causes this limitation.  However, even in these days of ever increasing reliability of Windows, an Interval that exceeds 1-day should use other techniques (see the Scheduler OCX that is/will be posted on this site).

The LongTimerIntervals OCX timer resolution is approximately 110 mS. However, because of limitations in the standard Windows Timer, accurate timing intervals are generated only when the Interval property exceeds 200 mS. I recommend Intervals of 300 mS or more for best accuracy.

Enabled (Boolean) – Change this property to enable/disable the timer.

Events

OnTimer- This event is generated when the specified interval has expired.

Disclaimer

This ActiveX control is provided free, without warranty of any kind. You are free to use it for any purpose that you deem reasonable, but the author is not responsible for any such use (or misuse), or for any damage that might result from its use. Treat this software like you would any beta software. It may work as described, but if it does not, you got what you paid for.

Feel free to contact me if you have problems. However, I cannot guarantee that I will be able to respond in a timely way. Please let me know about any successes.

Source Code (VB6) is available. Click here (about 11K, Zipped).  Naturally, since I don’t charge for this source code, I invite you to purchase a copy of my book; I do receive a small royalty from that!

Back to Hard & Software