• Welcome to Valhalla Legends Archive.
 

VB6 + WebBrowser control

Started by Grok, September 30, 2003, 04:23 PM

Previous topic - Next topic

Grok

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


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


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?

Banana fanna fo fanna

Don't know if this is exactly what you want...but

msgbox WebBrowser1.Document.images(0).src


WebBrowser1.Document is the same DOM document you get in javascript.

drivehappy

#2
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.