How to get time difference in milliseconds in VB6
Posted: Thu Mar 22, 2012 1:52 am
There is no direct method to get time difference in milliseconds in VB6. This is required for profiling functions where difference in seconds is not enough. Here is how you could do that.
Code: Select all
Private Declare Function GetTickCount Lib "kernel32" () As Long ‘For timer
Code: Select all
Dim dtStart As Long
Dim dtEnd As Long
Dim result As Long
Dim i As Integer
dtStart = GetTickCount
'Function to profile
dtEnd = GetTickCount
result = dtEnd – dtStart
MsgBox “Duration is ” & result & ” milliseconds.”