home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
VISBASIC
/
HITIME
/
SAMPLE.ZIP
/
HTSAMPLE.FRM
next >
Wrap
Text File
|
1994-08-31
|
4KB
|
163 lines
VERSION 2.00
Begin Form HTSAMPLE
Caption = "HiTime Sample"
ClientHeight = 3150
ClientLeft = 1260
ClientTop = 1605
ClientWidth = 4245
Height = 3555
Left = 1200
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 4245
Top = 1260
Width = 4365
Begin HScrollBar HScroll1
Height = 255
LargeChange = 25
Left = 240
Max = 1000
Min = 10
TabIndex = 0
Top = 1680
Value = 10
Width = 1335
End
Begin Timer Timer1
Interval = 1000
Left = 3480
Top = 240
End
Begin MabryHiTime HiTime1
Interval = 0
Left = 3000
Top = 240
End
Begin Label txtATPS
Alignment = 1 'Right Justify
Height = 255
Left = 2760
TabIndex = 9
Top = 2640
Width = 1215
End
Begin Label txtTLS
Alignment = 1 'Right Justify
Height = 255
Left = 2760
TabIndex = 8
Top = 2400
Width = 1215
End
Begin Label txtTT
Alignment = 1 'Right Justify
Height = 255
Left = 2760
TabIndex = 7
Top = 2160
Width = 1215
End
Begin Label Label6
Caption = "Average Ticks Per Second:"
Height = 255
Left = 240
TabIndex = 6
Top = 2640
Width = 2655
End
Begin Label Label5
Caption = "Ticks Last Second:"
Height = 255
Left = 240
TabIndex = 5
Top = 2400
Width = 2295
End
Begin Label Label4
Caption = "Total Ticks:"
Height = 255
Left = 240
TabIndex = 4
Top = 2160
Width = 2295
End
Begin Label Label3
Caption = "Play with the scroll bar and see how your machine handles smaller and larger intervals."
Height = 735
Left = 240
TabIndex = 3
Top = 840
Width = 3735
End
Begin Label Label2
Caption = "Interval = 10"
Height = 255
Left = 1680
TabIndex = 2
Top = 1680
Width = 2295
End
Begin Label Label1
Caption = "HiTime Sample"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 13.5
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 375
Left = 240
TabIndex = 1
Top = 240
Width = 2535
End
End
Option Explicit
Dim nTicksThisSecond As Long
Dim nTotalTicks As Long
Dim nTotalSeconds As Long
Sub Form_Load ()
Call HScroll1_Scroll
End Sub
Sub HiTime1_Timer ()
nTicksThisSecond = nTicksThisSecond + 1
End Sub
Sub HScroll1_Change ()
Call HScroll1_Scroll
End Sub
Sub HScroll1_Scroll ()
HiTime1.Interval = HScroll1.Value
Label2.Caption = "Interval = " & Format$(HScroll1.Value)
nTicksThisSecond = 0
nTotalTicks = 0
nTotalSeconds = 0
Call UpdateLabels
End Sub
Sub Timer1_Timer ()
nTotalTicks = nTotalTicks + nTicksThisSecond
nTotalSeconds = nTotalSeconds + 1
Call UpdateLabels
nTicksThisSecond = 0
End Sub
Sub UpdateLabels ()
txtTT = Format$(nTotalTicks)
txtTLS = Format$(nTicksThisSecond)
If nTotalSeconds = 0 Then
txtATPS = "0.0"
Else
txtATPS = Format$(nTotalTicks / nTotalSeconds, "0.0")
End If
End Sub