I need to make an application that picks up all the images and downloadable file in a Web Page using VB6.0. These downloaded items are to be savwed in Folder. How can I do this using Internet Control and Using Webbrowser Control?
Printable View
I need to make an application that picks up all the images and downloadable file in a Web Page using VB6.0. These downloaded items are to be savwed in Folder. How can I do this using Internet Control and Using Webbrowser Control?
Actually, you won't need the WebBrowser control unless you want to view the page from your app.
You will probably want something like a listbox to display all the downloadable items on a page as well as all the images.
Also, put the inet control on the form, and a button to start and a textbox to specify the location of the page (URL)
Quite simple, but saving pictures in this way takes a long time. I dunno how to get it quicker.Code:' You should have this:
' Form1
' Text1
' Command1
' List1
' Inet1
' Put the following code:
Private Sub Form_Load()
Command1.Caption = "GO!"
Text1.Text = ""
End Sub
Private Sub Command1_Click()
Dim sHTML As String
'Just a little error handling
If Len(Text1.Text) > 0 Then
'Set the Target page and get the HTML
'on that page.
With Inet1
.URL = Text1.Text
sHTML = .OpenURL
End With
'sHTML now contains the HTML for the
'WHOLE page.
'Here you'll parse sHTML for links to images and
'downloadable files and add the links to the listbox.
'To download the files, you will say:
Dim b() as Byte
b() = Inet1.OpenURL(Text1.Text, icByteArray)
'Then
Open "myfile" for binary as #1
Put #1,,b()
Close #1
End If
End Sub
You could also download files automatically.
Take a look at this link.
http://www.vb-world.net/tips/tip501.html