Results 1 to 7 of 7

Thread: Timers...

  1. #1

    Thread Starter
    Addicted Member Mage33's Avatar
    Join Date
    Aug 2000
    Location
    Petaluma, California
    Posts
    138

    Arrow

    Is there a timer which can keep time for more than just a few seconds. The generic VB timer has a low maximum time and IE's timer is barely better. I'm thinking in minutes. Or, is there a component which keeps track of how long it's been since an event occured? Either one would work for me, thanks for any help you can give.
    Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
    -ShardsOfSilence.net- ^ My name in ASCII ^
    You forget something new every day
    | WinME | VB6 Pro | MSC++ | Lambda MOO |

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986

    Timer

    I think you could use
    Timer
    to Measure how many seconds have past since the starting and ending of somethin'

    like this

    Code:
    Var BeginProgress As Long, EndProgress As Long
    'Before the Progress Starts, use this
       BeginProgress = Timer
    
    'The Start The Progress
       Call Progress
    
    'After the Progress call
       EndProgress As Long
    
    'Calculate in seconds
    MsgBox LTrim(Int(EndProgress - BeginProgress) * 100 + 0.5) / 100
    Hope that's what you wanted!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3
    Member
    Join Date
    Jul 2000
    Location
    BFE in Oregon
    Posts
    33
    Perhaps this will do well, I use it.

    <Declarations>
    Global TimeStart as Date

    <in routine you wish to time>
    Static TimeStart as Date 'Global & Static so you can check it from anywhere.

    'place this just before you call the function/sub you want to time
    TimeStart = now

    'after it's finished use this to determine how long it took in seconds
    Label1.Caption = "Processed file in " & DateDiff("s", TimeStart, Now) & " second(s)"

  4. #4
    New Member
    Join Date
    Aug 2000
    Posts
    2

    Unhappy

    The API function GetTickCount gives the time in milliseconds, elapsed since system start up (maximum of 49.7 days). You can manipulate it to be used for keeping track of longer durations of time.

  5. #5
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    There are a few suggestions on this subject here:

    http://forums.vb-world.net/showthrea...threadid=28360

    and here:

    http://forums.vb-world.net/showthrea...threadid=27124

    [Edited by jbart on 08-31-2000 at 01:00 PM]

  6. #6
    Guest
    Try this example using GetTickCount
    Code:
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    
    Sub Pause(dwInterval As Long)
        Start = GetTickCount
        
        Do While GetTickCount < Start + dwInterval
        DoEvents
        Loop
    End Sub
    
    Private Sub Command1_Click()
        'Pause program for 1 hour
        Pause 36000000
        MsgBox ("1 hour has passed by")
    End Sub

  7. #7

    Thread Starter
    Addicted Member Mage33's Avatar
    Join Date
    Aug 2000
    Location
    Petaluma, California
    Posts
    138

    Thanks!!

    Thanks, Mega, that's exactly what I needed. It'll be really useful.
    Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
    -ShardsOfSilence.net- ^ My name in ASCII ^
    You forget something new every day
    | WinME | VB6 Pro | MSC++ | Lambda MOO |

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