|
-
Dec 7th, 2002, 10:28 PM
#1
Thread Starter
Addicted Member
getting the time between the time it takes to click one button ************(resolved)
how do you go about getting the time (in milliseconds) between the time it takes to click one button and then the next?
I have already tried to use a timer and do this code
sub timer_timer()
a = a + 1 'a being the integer
end sub
When i return what a = it gives me a number like 400 even though it took me 5 seconds to click the button
your help would be much appreasiated Thanks
Last edited by king_scott_2; Dec 12th, 2002 at 08:51 PM.
-
Dec 7th, 2002, 10:36 PM
#2
VB Code:
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private lTime As Long
Private Sub Command1_Click()
lTime = GetTickCount
End Sub
Private Sub Command2_Click()
MsgBox (GetTickCount - lTime) & " milliseconds"
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 7th, 2002, 10:37 PM
#3
Use GetTickCount. Here's an example, make a new project, insert two command buttons and add the following code:
VB Code:
Option Explicit
Dim Button1 As Long, Button2 As Long
Private Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
Private Sub Command1_Click()
Button1 = GetTickCount
End Sub
Private Sub Command2_Click()
Button2 = GetTickCount
Caption = "Took " & Button2 - Button1 " milliseconds"
End Sub
Hope this does the trick 
Edit Damn I'm slow
-
Dec 12th, 2002, 08:50 PM
#4
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|