Has anyone made a ActiveX control class module and added a timer withevents without having to add a timer to a form? I would like to use the timer control or if possible a 3rd party class module.
Printable View
Has anyone made a ActiveX control class module and added a timer withevents without having to add a timer to a form? I would like to use the timer control or if possible a 3rd party class module.
take a look at the API SetTimer, KillTimer
They require a public function in a .BAS module, The SetTimer api will make a call to the public module when the time ends. this doesn't solve my problem of having a timer event in a class module without dependancy forms or .bas modules.
Jean-Guy
There are some limitations to timers in VB because the variable is only a 16 bit value. The timer will only track time for up to 24 hours and then will roll back over to 0. If you really need accurate timing functions it would be best to write the timer routine as a DLL in C++ because the timer used in c++ is a 32 bit value and has a rollover period of some outrageous numb er like 200+ years. This is important when controlling processes and/or controlling automated machinery with VB. Somewhere I have a C++ DLL file that you could use... I will see if I cant rummage it up and send it to you.
Joe
I am not sure why you want to restrict yourself to not using .bas modules cause it u create the class in ActiveX DLL, the user might not even know you got a module there.
However, if u intention is, after the timer end, you need to raise an event from the class to notify a user, one way to do it is ask the user to suppy a callback function using addressof operator.
HTH