CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2000
    Location
    Ottawa, Ontario
    Posts
    356

    timers without a form

    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.


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: timers without a form

    take a look at the API SetTimer, KillTimer


  3. #3
    Join Date
    Sep 2000
    Location
    Ottawa, Ontario
    Posts
    356

    Re: timers without a form

    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


  4. #4
    Join Date
    Nov 2000
    Location
    Ohio
    Posts
    238

    Re: timers without a form

    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



  5. #5
    Join Date
    Apr 2000
    Posts
    737

    Re: timers without a form

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured