|
-
Mar 29th, 2006, 06:12 PM
#1
Thread Starter
Frenzied Member
-
Mar 29th, 2006, 07:01 PM
#2
Frenzied Member
Re: Time Taken To Download Web Page!
Use the DateDiff() function....
At the start of your function get Now..
VB Code:
Dim This
This = Now
'Load page here....
TimeElapsed = DateDiff("s", Now & This) 'Gives you the difference in Seconds.
That should do it.
Also, you should put a Do Until loop around loading the page, so it won't calculate the time until it's done.
Last edited by Spajeoly; Mar 29th, 2006 at 07:06 PM.
Reason: Forgot something
-
Mar 29th, 2006, 07:02 PM
#3
Re: Time Taken To Download Web Page!
Have a module level variable (lets call it nNavigationTime in this example) that you assign the return value of GetTickCount before you navigate to a new URL. You can then get the time it took by adding this code in the DocumentComplete event.
VB Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Object) Then
nNavigationTime = GetTickCount - nNavigationTime
MsgBox "It took " & nNavigationTime / 1000 & " seconds to download this page"
End If
End Sub
-
Mar 29th, 2006, 07:07 PM
#4
Frenzied Member
Re: Time Taken To Download Web Page!
 Originally Posted by Joacim Andersson
Have a module level variable (lets call it nNavigationTime in this example) that you assign the return value of GetTickCount before you navigate to a new URL. You can then get the time it took by adding this code in the DocumentComplete event.
VB Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Object) Then
nNavigationTime = GetTickCount - nNavigationTime
MsgBox "It took " & nNavigationTime / 1000 & " seconds to download this page"
End If
End Sub
Well, that works too... =\
-
Mar 29th, 2006, 07:24 PM
#5
Thread Starter
Frenzied Member
-
Mar 29th, 2006, 07:32 PM
#6
Re: Time Taken To Download Web Page!
 Originally Posted by arpan_de
But what is this GetTickCount?
Oh sorry. It's an API function.
VB Code:
Private Declare Function GetTickCount Lib "kernel32.dll" () As Long
-
Mar 29th, 2006, 07:59 PM
#7
Thread Starter
Frenzied Member
Re: Time Taken To Download Web Page!
But under which sub in the Module should nNavigationTime be assigned the return value of GetTickCount? Is this correct?
VB Code:
'[u]Form Code[/u]
Private Sub wWeb_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
Call TimeElapsed
End Sub
'[u]Module Code[/u]
Private Declare Function GetTickCount Lib "kernel32.dll" () As Long
Public nNavigationTime As Long
Public Sub TimeElapsed()
nNavigationTime = GetTickCount
End Sub
ARPAN
IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!
NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!
PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?
-
Mar 29th, 2006, 08:11 PM
#8
Thread Starter
Frenzied Member
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
|