Results 1 to 3 of 3

Thread: elapsed time

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Location
    italy
    Posts
    2

    Post

    I need to count the milliseconds elapsed from a starting point.
    How can i do?

  2. #2
    Junior Member
    Join Date
    Mar 2000
    Posts
    29

    Post Timer control

    Hi,

    Use a Timer control (the control that looks like a little hand watch). Look up the help if you need to; it's really easy to use.

    Raggart

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Post

    beside using the Timer control, you also can you the Win32 API function as below:

    Option Explicit
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Dim StartTime As Long ' in Miliseconds
    Dim EndTime As Long ' in Miliseconds
    Dim TotalDuration As Long ' in Miliseconds

    Private Sub Command1_Click()
    StartTime = GetTickCount
    End Sub

    Private Sub Command2_Click()
    EndTime = GetTickCount
    TotalDuration = EndTime - StartTime

    End Sub

    If you feel the above method does not meet you require precision, then you can use the QueryPerformanceFrequency and QueryPerformanceCounter Win32 API function, but this is more complex than the GetTickCount that I show above. For this function you need to declare the following Types:

    Private Type LARGE_INTEGER
    LowPart As Long
    HighPart As Long
    End Type

    Hope this can speed up your program performance.




    Edited by Chris on 03-09-2000 at 12:48 PM

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