You need to parse the frames page for the FRAME SRC tags
try this:
Code:
Option Explicit
Option Compare Text
Public Sub DownLoad(remoteFile As String, localfile As String)
'insert download code here
Dim b() As Byte
Dim fnum As Long
On Error Resume Next
fnum = FreeFile
' Retrieve the file as a byte array.
b() = Inet1.OpenURL(remoteFile, icByteArray)
Open localfile For Binary Access Write As #fnum
Put #fnum, , b()
Close #fnum
End Sub
Public Sub ParseFile(Filename As String)
Dim fnum As Byte
Dim strTemp As String
Dim pos As Integer
Dim strSRC As String
Dim Char As String
Dim i As Integer
fnum = FreeFile
Open Filename For Binary As fnum
strTemp = Space(LOF(fnum))
Get #fnum, , strTemp
Close #fnum
Do
pos = InStr(strTemp, "frame ")
If pos > 0 Then
'trimto frame
strTemp = Mid(strTemp, pos)
'trim to src
pos = InStr(strTemp, "SRC")
strTemp = Mid(strTemp, pos)
'<frame name="contents" src="contents.htm">
'trim to "
pos = InStr(strTemp, Chr(34))
strTemp = Mid(strTemp, pos + 1)
strSRC = ""
For i = 1 To Len(strTemp)
Char = Mid(strTemp, i, 1)
If Char = Chr(34) Then
Exit For
Else
strSRC = strSRC & Char
End If
Next i
List1.AddItem strSRC
Else
Exit Do
End If
Loop
End Sub
Private Sub Command1_Click()
Dim remoteRoot As String
Dim i As Integer
DownLoad Text1.Text, "c:\tempfile.htm"
remoteRoot = GetRoot(Text1.Text)
ParseFile "c:\tempfile.htm"
'so far so good
'now download the files
For i = 0 To List1.ListCount - 1
DownLoad remoteRoot & List1.List(i), "c:\myfiles\" & List1.List(i)
Next i
End Sub
Private Function GetRoot(Filename As String) As String
On Error Resume Next
' Return the path name from the full file name
Dim Counter As Long
Counter = Len(Filename)
While Counter > 0 And Mid(Filename, Counter, 1) <> "/"
Counter = Counter - 1
Wend
GetRoot = Left(Filename, Counter)
End Function