I need a timer

Discussion in 'AutoCAD' started by Hartmut Callies, Oct 18, 2004.

  1. Hello,
    in my autocad 2004-program (vba) I need a timer-control or object (how in
    VB 6).
    But I didn't find the control.
    Always after 5 seconds the timer must start a program?
    What can I do?

    Thanks.

    Hartmut Callies
     
    Hartmut Callies, Oct 18, 2004
    #1
  2. Hartmut Callies

    MP Guest

    You have various options depending on granularity required.
    The simplest may be the built in timer function.
    Only problem is if you run the program 3 seconds before midnight :)
    from the help files:
    quote:
    Dim PauseTime, Start, Finish, TotalTime
    If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
    PauseTime = 5 ' Set duration.
    Start = Timer ' Set start time.
    Do While Timer < Start + PauseTime
    DoEvents ' Yield to other processes.
    Loop
    Finish = Timer ' Set end time.
    TotalTime = Finish - Start ' Calculate total time.
    MsgBox "Paused for " & TotalTime & " seconds"
    Else
    End
    End If
    end quotefor greater accuracy than one second intervals you can use various
    winapi functions.eg:The timeGetTime function retrieves the system time, in
    milliseconds. The system time is the time elapsed since Windows was
     
    MP, Oct 18, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.