|
-
Jan 11th, 2000, 11:06 AM
#1
Thread Starter
Junior Member
How do I display a live clock, updated every second, that shows how long you have been running the current application? Come on guys, I know it's possible...
------------------
Webmaster Czaries
http://www1.50megs.com/css
-
Jan 11th, 2000, 11:39 AM
#2
Registered User
I don't understood very well, you want put this code in your form/mdi or in a clock out the app, like allways visible?
Jefferson
-
Jan 11th, 2000, 12:48 PM
#3
Put a timer on the form and set it's interval to 100. Then do the following:
Code:
Private Sub Timer1_Timer()
Static m_dTotal As Double
Static m_dStart As Double
Static m_dCurrent As Double
Dim x As Integer
m_dStart = Timer ' Set start time.
Do
m_dCurrent = Timer - m_dStart
x = x + 1
If x = 500 Then
Text1.Text = "Working for " & HoursAndMinutes(m_dTotal + m_dCurrent)
x = 0
End If
DoEvents ' Yield to other processes.
Loop
End Sub
------------------
Marty
-
Jan 12th, 2000, 02:45 AM
#4
I forgot to include the HoursAndMinutes routine. Here it is.
Code:
Public Function HoursAndMinutes(dSeconds) As String
HoursAndMinutes = Format(dSeconds \ 3600, "00") & ":" _
& Format(((dSeconds \ 60) Mod 60), "00") & ":" _
& Format(dSeconds Mod 60, "00")
End Function
------------------
Marty
-
Jan 12th, 2000, 12:16 PM
#5
Thread Starter
Junior Member
Thank you guys, and I did mean display it on a form.
------------------
Webmaster Czaries
http://www1.50megs.com/css
-
Jan 12th, 2000, 12:24 PM
#6
Thread Starter
Junior Member
Thank You for the correction. I was wondering why it kept giving me an error...
------------------
Webmaster Czaries
http://www1.50megs.com/css
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
|