I like to monitor time elapse in ms. Can someone point me to the the right
api function, and how to interpret the result?
I wonder why the good old Quick basic function is not available in vb...
Thanks in advance.
Chut Ngeow Yee
You could use the following...
' API Declarations...
' Use VB Currency type instead of LARGE INTEGER type.
Private Declare Function QueryPerformanceCounter Lib "kernel32" _
(lpPerformanceCount As Currency) As Long
Private Declare Function QueryPerformanceFrequency Lib "kernel32" _
(lpFrequency As Currency) As Long
Private m_secFreq As Currency
Private Sub StartTimer(secStart As Currency)
If m_secFreq = 0 Then QueryPerformanceFrequency m_secFreq
QueryPerformanceCounter secStart
End Sub
Private Sub StopTimer(secStart As Currency, secTimer As Currency)
QueryPerformanceCounter secTimer
If m_secFreq = 0 Then
secTimer = 0 ' Cannot Handle Performace Timer
Else
secTimer = (secTimer - secStart) / m_secFreq
End If
End Sub
You can then call the function.
Private Sub Command1_Click()
Dim secStart As Currency
Dim secEnd As Currency
StartTimer secStart
' Do Stuff...
StopTimer secStart, secEnd
' Result Stored in secEnd
End Sub
Hope this helps...
Garth Oatley
Chut Ngeow, Yee <y...@ctsolution.com.my> wrote in article
<01bd5163$71e6b880$LocalHost@ngeow>...
>>Gofreddo wrote in message ...
>>or you could use Timer.
Only if you wanted a completely inaccurate span of time <g>. The Timer
control is notorious for being a bit on the "it's been around 200 or so ms
so let's fire the routine" side of things
André-Tascha Ham-Lammé wrote in message <6en6hs$o...@suriname.earthlink.net>...