T
tqm1
Dear Sir,
I wrote following codes to display windows Tickcount.
This userform work fine.
When commandbutton1 is pressed then Windows usage time displays.
I want to display it continuously. I mean when Userform loads then it
should display running timer.
please help
Code:
--------------------
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub CommandButton1_Click()
Dim tickcount As Long
tickcount = GetTickCount()
Me.TextBox1.Value = tickcount
Call tick2time
End Sub
Sub tick2time()
Dim LNTICK As Long, LNHOUR As Integer, LNMIN As Integer
LNTICK = Me.TextBox1.Value
TNHOURS = Int(LNTICK / 3600000)
If (TNHOURS > 23) Then
TNDAYS = Int(TNHOURS / 24)
TNHOURS = TNHOURS Mod 24
Else
TNDAYS = 0
End If
LNTICK = LNTICK Mod 3600000
TNMINUTES = Int(LNTICK / 60000)
TNSECOND1 = (LNTICK Mod 60000) / 1000
TNSECONDS = Int(TNSECOND1)
Me.TextBox2.Value = Format(TNHOURS, "00") + ":" + Format(TNMINUTES, "00") + ":" + Format(TNSECONDS, "00")
MsgBox ("Windows has started since " + Me.TextBox2.Value)
End Sub
--------------------
I wrote following codes to display windows Tickcount.
This userform work fine.
When commandbutton1 is pressed then Windows usage time displays.
I want to display it continuously. I mean when Userform loads then it
should display running timer.
please help
Code:
--------------------
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub CommandButton1_Click()
Dim tickcount As Long
tickcount = GetTickCount()
Me.TextBox1.Value = tickcount
Call tick2time
End Sub
Sub tick2time()
Dim LNTICK As Long, LNHOUR As Integer, LNMIN As Integer
LNTICK = Me.TextBox1.Value
TNHOURS = Int(LNTICK / 3600000)
If (TNHOURS > 23) Then
TNDAYS = Int(TNHOURS / 24)
TNHOURS = TNHOURS Mod 24
Else
TNDAYS = 0
End If
LNTICK = LNTICK Mod 3600000
TNMINUTES = Int(LNTICK / 60000)
TNSECOND1 = (LNTICK Mod 60000) / 1000
TNSECONDS = Int(TNSECOND1)
Me.TextBox2.Value = Format(TNHOURS, "00") + ":" + Format(TNMINUTES, "00") + ":" + Format(TNSECONDS, "00")
MsgBox ("Windows has started since " + Me.TextBox2.Value)
End Sub
--------------------