Technical Aspects in IT

Stand on the shoulders of giants – http://scholar.google.com

Calculating time difference in milliseconds in VB6

Posted by scmay on March 23, 2007

As a VB6 programmer, I am finding even more difficult to find pieces of VB6 code these days. As all VB6 programmers might know, VB6 and VB.NET has slight differences (VB.NET is claimed to be 100% Object Oriented)

So here is a snippet of code that calculates the time difference in milliseconds

Public Declare Function GetTickCount Lib “kernel32″ () As Long ‘For timer

Function_name()

Dim dtStart As Long
Dim dtEnd As Long
Dim result As Long
Dim i As Integer

dtStart = GetTickCount

‘Do task

dtEnd = GetTickCount
result = dtEnd – dtStart
MsgBox “Duration is ” & result & ” milliseconds.”


End Function

Taken from here

3 Responses to “Calculating time difference in milliseconds in VB6”

  1. Tom said

    Thanks, that helped.

  2. Thanks for this piece. Works great. You may want to look at a plugin called codesnippet (http://wordpress.org/extend/plugins/codesnippet-20/) so that its easier to copy and paste code from your blog. I noticed it didn’t paste nicely into vb6. Thanks again.

  3. Prabhakaran said

    Great, It helped me a lot.

    Thanks

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>