How to make Stopwatch program in vb6
Code
Option Explicit
Dim StartTime As Variant
Dim EndTime As Variant
Dim ElapsedTime As Variant
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub cmdEnd_Click()
'Find the ending time, compute the elapsed time
'Put both values in label boxes
EndTime = GetTickCount() / 1000
ElapsedTime = EndTime - StartTime
lblEnd.Caption = Format(EndTime, "#########0.000")
lblElapsed.Caption = Format(ElapsedTime, "#########0.000")
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdStart_Click()
'Establish and print starting time
StartTime = GetTickCount() / 1000
lblStart.Caption = Format(StartTime, "#########0.000")
lblEnd.Caption = ""
lblElapsed.Caption = ""
End Sub
Private Sub Form_Load()
End Sub
No comments:
Post a Comment