by king (24 Submissions)
Category: Internet/HTML
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 16th January 2004
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
fetch all internet links from the website as you want very easy!
API Declarations
all you have to do is you need two timers , listbox , 2 buttons , one textbox, progressbar and a status bar thats it... now lets go:
copy these codes on your project.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private searchme As SHDocVw.InternetExplorer
Private url_arr() As String
step 1
first you have to place the tools on the form you can do it by your own style . The main purpose of mine is to show you how it works.
step2
you will need two button give the buttons caption stop and search respectively.
On the search button write the following code::
List1.Clear
errorifnot
navigate
ProgressBar1.Value = 0
Timer1.Enabled = True
Command1.Enabled = False
now here i have explain everything in procedures please write this code on your search button event.
step 3
now you have two timer controls respectively for timer 1 give the interval 700
and for timer2 give the interval 12000
now on timer1 write the following code
Private Sub Timer1_Timer()
ProgressBar1.Visible = True
If ProgressBar1.Value < ProgressBar1.Max Then
ProgressBar1.Value = ProgressBar1.Value + 1
Timer2.Enabled = True
ElseIf ProgressBar1.Value = ProgressBar1.Max Then
StatusBar1.Panels(1).Text = " File(s) found " & Str(i)
Command1.Enabled = True
ProgressBar1.Visible = False
Text1.Text = ""
frmlinks.Refresh
List1.Refresh
Timer2.Enabled = False
Timer1.Enabled = False
End If
End Sub
and on timer2 write the following code
On Error Resume Next
List1.Clear
For i = 0 To searchme.Document.links.length - 1
ReDim url_arr(i To 1)
List1.AddItem searchme.Document.links(i).href
List1.AddItem searchme.Document.vlinks(i).Color = vbRed
url_arr(i + 1) = searchme.Document.links(i).href
StatusBar1.Panels(1).Text = " File(s) found " & Str(i)
ProgressBar1.Visible = False
Command1.Enabled = True
Timer1.Enabled = False
end sub
now you need to make small procedures like navigate
and write this code as it is
Private Sub navigate()
On Error Resume Next
searchme.navigate Text1.Text
Label4.Caption = " You searched for " & " ' " & Text1.Text & " ' "
StatusBar1.Panels(1).Text = "Please wait while we search the links for you this may take few minutes so please patient"
End Sub
now make the procedure errorifnot and write the code as it is
Private Sub errorifnot()
On Error Resume Next
If Text1.Text = "" Then
MsgBox " No text entered to search for ", vbExclamation
List1.Clear
searchme.Stop
searchme.navigate "http://www.plain.htm"
Timer1.Enabled = False
Timer2.Enabled = False
Command1.Enabled = True
End If
End Sub
thats it now you run your project and see . Please make sure that u dont change the name of a single tool.Leave them as it is.
If you want to me ask me more about this you are free to email me at [email protected]. I will help you regarding vb source codes.
No comments have been posted about fetch all internet links from the website as you want very easy!. Why not be the first to post a comment about fetch all internet links from the website as you want very easy!.