Valhalla Legends Forums Archive | Web Development | VB6 + WebBrowser control

AuthorMessageTime
Grok
I've got a WebBrowser control on a form, and have coded it to attempt retrieval of some JPG files.

[code]
Private Doc As MSHTML.HTMLDocument

Private Sub cmdGo_Click()
mURL = txtURL.Text & txtUID.Text & "_" & txtPID.Text & ".jpg"
mCancel = False
wb.Navigate mURL
End Sub

Private Sub wb_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
If mCancel = False Then
DoEvents
Stop
Set Doc = wb.Document
'
'how do I save any .JPG file that is in the document?
'
End If
End Sub

Private Sub wb_NavigateError(ByVal pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean)
Cancel = True
mCancel = True
End Sub
[/code]

In the NavigateComplete2 event, how do I look through the document and grab any JPG file that is present, and save it to a directory?
September 30, 2003, 9:23 PM
St0rm.iD
Don't know if this is exactly what you want...but
[code]
msgbox WebBrowser1.Document.images(0).src
[/code]

WebBrowser1.Document is the same DOM document you get in javascript.
September 30, 2003, 10:36 PM
drivehappy
I usually use the Inet OCX and use the OpenURL method and parse the string for the path. Then use the Inet OCX to download.

Wow, those webbroswer methods would have been helpful to know like a year ago.
September 30, 2003, 10:41 PM

Search