Results 1 to 3 of 3

Thread: Timer without a timer?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473

    Unhappy Timer without a timer?

    Hi.
    I am making a plugin for a program.
    Is there a way to have a "timer" perform an action every x seconds?
    I could show an invisible form but when a vb plugin shows a form the plugin host freezes and only the plugin can work.
    Althought i havent tested this with me.hide ...
    But it it doesnt "freeze" when it is a C++ form...

    Anyway how can i make a timer without a timer?

    Thanks!

  2. #2

  3. #3
    Fanatic Member doofusboy's Avatar
    Join Date
    Apr 2003
    Posts
    526
    Maybe you can play with this; set the variable 'showTime' to False to start, True to stop displaying current time. [no Timer control needed]

    If you need to know time expired, capture time when started and stopped and calculate the difference.

    VB Code:
    1. Option Explicit
    2. Dim showTime As Boolean
    3.  
    4. Private Sub DisplayTime()
    5. Do While showTime = False
    6.     lblCurrentTime.Caption = Time
    7.     DoEvents
    8. Loop
    9.    
    10. End Sub
    11.  
    12. Private Sub Form_Load()
    13.     showTime = False
    14.     Me.Show
    15.     DisplayTime
    16. End Sub
    17.  
    18. Private Sub Form_Unload(Cancel As Integer)
    19.     showTime = True
    20. End Sub
    Do canibals not eat clowns because they taste funny?

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