Results 1 to 4 of 4

Thread: Time Elapse

  1. #1

    Thread Starter
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619

    Question


    would to requesting for a code that would monitor
    time elapsed.

    Any guru's willing to help?


  2. #2
    Guest
    well ive got no idea
    but could u help me out with the phone thing?

  3. #3
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    You can use the GetTickCount API function to get the number of milliseconds since system startup. It is a long value, so it overflows and resets to 0 after (I think) about 49.7 or so days (4,294,967,296 milliseconds). Here's the declaration:
    Code:
    Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
    Stick that in a module. You can time things by recording the tick count at the beginning of the process, and then subtracting that value from subsequent sample tick counts. So, in your code, you might have something like this:

    Code:
    Dim startTick As Long
    Dim currentTick As Long
    Dim interval As Long
    
    startTick = GetTickCount
    
    'Other code could go here if you were timing the length
    'of time your code took to execute
    
    'If you make the startTick variable global or static you
    'can set it, then let the user do stuff and time their actions
    
    currentTick = GetTickCount
    
    interval = currentTick - startTick
    
    MsgBox "Time = " & interval & " milliseconds."


    Alternatively, you can get Windows to run a timer for you, using the SetTimer and KillTimer functions. You'll have to look that up in the help though, because I only really know how to do that in C.

    Hope that helps some
    Harry.

    "From one thing, know ten thousand things."

  4. #4

    Thread Starter
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619

    Thumbs up

    thanks harry!

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