|
-
Aug 30th, 2000, 07:24 PM
#1
Thread Starter
Addicted Member
Is there a timer which can keep time for more than just a few seconds. The generic VB timer has a low maximum time and IE's timer is barely better. I'm thinking in minutes. Or, is there a component which keeps track of how long it's been since an event occured? Either one would work for me, thanks for any help you can give.
Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
-ShardsOfSilence.net- ^ My name in ASCII ^
You forget something new every day
| WinME | VB6 Pro | MSC++ | Lambda MOO |
-
Aug 30th, 2000, 07:34 PM
#2
Frenzied Member
Timer
I think you could use
Timer
to Measure how many seconds have past since the starting and ending of somethin'
like this
Code:
Var BeginProgress As Long, EndProgress As Long
'Before the Progress Starts, use this
BeginProgress = Timer
'The Start The Progress
Call Progress
'After the Progress call
EndProgress As Long
'Calculate in seconds
MsgBox LTrim(Int(EndProgress - BeginProgress) * 100 + 0.5) / 100
Hope that's what you wanted!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Aug 30th, 2000, 08:33 PM
#3
Member
Perhaps this will do well, I use it.
<Declarations>
Global TimeStart as Date
<in routine you wish to time>
Static TimeStart as Date 'Global & Static so you can check it from anywhere.
'place this just before you call the function/sub you want to time
TimeStart = now
'after it's finished use this to determine how long it took in seconds
Label1.Caption = "Processed file in " & DateDiff("s", TimeStart, Now) & " second(s)"
-
Aug 31st, 2000, 11:51 AM
#4
New Member
The API function GetTickCount gives the time in milliseconds, elapsed since system start up (maximum of 49.7 days). You can manipulate it to be used for keeping track of longer durations of time.
-
Aug 31st, 2000, 11:56 AM
#5
Fanatic Member
-
Aug 31st, 2000, 11:57 AM
#6
Try this example using GetTickCount
Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Sub Pause(dwInterval As Long)
Start = GetTickCount
Do While GetTickCount < Start + dwInterval
DoEvents
Loop
End Sub
Private Sub Command1_Click()
'Pause program for 1 hour
Pause 36000000
MsgBox ("1 hour has passed by")
End Sub
-
Sep 4th, 2000, 11:46 PM
#7
Thread Starter
Addicted Member
Thanks!!
Thanks, Mega, that's exactly what I needed. It'll be really useful.
Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
-ShardsOfSilence.net- ^ My name in ASCII ^
You forget something new every day
| WinME | VB6 Pro | MSC++ | Lambda MOO |
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
|