nearlogic.com

a programmer’s blog

It’s About Time

Here’s a solution to the lack-luster Timer Control in VB6.  Instead of requiring a Form, the code is contained in a class module.  It is similar to other Timer class implementations you can find on the web, with one major difference.  Each timer requires a call-back function, so to avoid having to keep track of the call-back for every class, a Collection is used, and a single call-back function is re-used.  This allows you to use the class as a drop-in replacement for the VB Timer Control.  The only thing that is required is to create the collection at the beginning of your app, and to make sure your timers are disabled before releasing them.

Take a look at the code to see what I’m talking about.   There are also a couple extra features in this class, like a One-Shot mode, and Elapsed Time counter.

Download Here (10kB) 

No comments yet. Be the first.

Leave a reply

Banner