Source code for Issue Number 37

Copyright 1997-2000 by C&D Programming Corp. All Rights Reserved. Source code may not be reproduced except for use in a compiled executable. All rights reserved. If you would like to reprint any or all of this code please email us at info@codeoftheweek.com

Code of the Week Home


Source Code

Since this source code contains several parts we have put it online at http://www.codeoftheweek.com/timer.zip

The ZIP file contains the entire project for the VBTimer control and the the test project. The easiest way to use this project is to load the program group called TimerProject.VBG into VB5.

The VBTimer.DLL (which is only 10,240 bytes) was also shipped in the ZIP file. To use VBTimer directly you will need to register it. Your VB5 CD should contain a program called REGSVR32.EXE. You should copy it to your Windows directory. To register the DLL, Click Start and then Run. At the prompt line enter REGSVR32 \VBTimer.DLL and press Enter. is the location of the VBTimer.DLL. You then can add a Reference to your project by selecting the Project menu in VB5 and the References menu item. In the list of available references you should see one called VB Timer Routines. Select that one and you should now be able to declare your object using the following code:

    Dim WithEvents tmr As VBTimer.Timer
    Set tmr = CreateObject("VBTimer.Timer")