SRL Archive - C#/Visual Basic Help and Tutorials

Detecting Websites


Diabloizzle

2007-09-17 22:42:57

Does anyone know how to (in visual basic 6.0) detect if a certain web page has been opened? I am not that good in vb yet when using commands that work with the user32 or any of that fun stuff…(ugh). My last thread in vb REALLY helped me alot so im hoping for the same here. If this is at all possible please let me know! :D
–diabloizzle

shaunthasheep

2007-09-26 15:38:35

It's easy if your trying to detect the website being visited in the Microsoft Internet Control if your using it in you application.

Smartzkid

2007-09-27 15:30:11

Detecting whether…
-The site is currently being loaded?
-The user has opened the site in the past?
-The site is currently open in a browser?

Buckleyindahouse

2007-09-29 07:12:13

Site = Inet.OpenURL("URL",something)
If(Str(Site)"Site text Here"))Then
Blah
End If

rogeruk

2007-09-29 07:57:10

I use a NavigateAndWait in my webbased applications..

Private Sub NavigateAndWait(ByVal URL As String)
'Navigate to a URL, and wait for it to fully display.
Dim StartTime As Long
StartTime = timeGetTime
StatusBar1.Panels(3).Text = ""
ProgressBar1.Visible = True
MousePointer = vbHourglass
CurrentURL = ""
WebBrowser1.Navigate URL
Do Until CurrentURL > ""
DoEvents
Loop
MousePointer = vbDefault
ProgressBar1.Visible = False
StatusBar1.Panels(3).Text = "Elapsed: " & Format((timeGetTime - StartTime) / 1000, "#.00") & " seconds"
End Sub

Which basically loads the page and waits untill it is loaded.

If your doing anything on the pages you can check if the page contains certain code..

Private Function WebPageContains(ByVal s As String) As Boolean
'Returns whether or not the web page contains a certain phrase.
Dim I As Long, HTMLElement
For I = 1 To WebBrowser1.Document.All.length
Set HTMLElement = WebBrowser1.Document.All.Item(I)
If Not (HTMLElement Is Nothing) Then
If InStr(1, HTMLElement.innerHTML, s, vbTextCompare) > 0 Then
WebPageContains = True
Exit Function
End If
End If
Next I
End Function

My application was simply a bot for Dark-Future and Pimp Area, which combined my own OCR and script for crimes and stuff.

Diabloizzle

2007-09-30 00:07:14

i was thinking of something that would run on a timer…that will detect a certain website being opened or IS open (on any bowser)…lets take runesacpe for example…cause we all love that game…

tmr
tryandfindwebsite
iffound…
nernerner
endif
endsub…

that kinda thing…so that if i have it running it will detct certain websites that opens from anywhere(anybowser) on my comp.

kinda make sense now?
buckleyindahouse-i think that might work..im going to test it soon
rogeruk-sigh…now your getting to complex for my small little brain.. :) That is for just opening a website though right?

rogeruk

2007-10-05 06:47:27

The navigate and wait will simply navigate to a page and wait for it to load ^_^.

You want to detect if ANY browser has runescape open? as in Firefox etc?. If so the aboves are not gonna work lol.

Diabloizzle

2007-10-07 22:44:23

Yah-i kinda want something like a internet block-but it just KNOWS when the site is up. (Im trying to record my total time on) *also my brothers*

R0b0t1

2007-10-08 19:37:00

You should take this question to a news group, and just so they can understand you, word it somewhat like this:
Is there a way I can detect if another program (In this case, a web browser) has a certain property for an element (In this case, with the web browser, if a web page is being viewed)?

rogeruk

2007-10-10 20:21:51

From: Diabloizzle
Yah-i kinda want something like a internet block-but it just KNOWS when the site is up. (Im trying to record my total time on) *also my brothers*


Total time on what?, the PC? using a browser? Runescape only?

Diabloizzle

2007-10-14 00:58:08

R0b0t1- thanks, ill try that

rogeruk- i want to be able to record total time on just runescape, running from any web browser.