Saving web page with images using the WebBrowser control 
Author Message
 Saving web page with images using the WebBrowser control
I'm using the WebBrowser control in VB 6.0
I am able to save a web page with the following code:

   Dim a as String, FileName as String

   FileName="C:\WebPage.htm"
   a=""

   Me.wb.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, FileName, a

Is there a way to save the images contained in the page?

I have tried to install InternetExplorer 5.0, wich has this option, but
nothing has changed in my appication... Do I have to change something in the
references/components page?

Anybody knows the solution?



Sun, 19 May 2002 03:00:00 GMT  
 Saving web page with images using the WebBrowser control
Err - I would look into the inet control :]

Once you've got the page you want - get it using the inet control, which
returns a string (variant) which is the source code for the page (the same
as View source in IE)...

''code
'dim page as variant
'Page = InetConnection.OpenURL("http://www.yahoo.com")

Then write some nifty string handling procedures to search out the images
inside it and store in an array (or DB if you want)

''code
'dim position as long
'dim endofcurrentimage as long
'dim imagetag as string
'
'position = instr(1, page, "<img src=""", vbTextCompare) 'look for the start
of an image tag
'endofcurrentimage = instr(position, page, ">", vbTextCompare) 'then for the
end
'
'imagetag = mid(page, position, endofcurrentimage)

then (again ;]) you can use the inet control to grab the images.

''cant remember this bit (but it will be similar to the openUrl command :]

Hope this helps :]

Dave



Sun, 19 May 2002 03:00:00 GMT  
 Saving web page with images using the WebBrowser control
I pasted your code into a vb project and it did save the images in a
subdirectory beneath the HTML file.  Make sure it works for you like
that in native IE5.  I am using IE5 and had IE4 before that.  Maybe you
should uninstall and reinstall IE5.  Since you created your project
before installing IE5 that might also be an issue.

Thanks,

Phil Threadgould

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 20 May 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Saving web pages to file using webBrowser or inet control

2. Saving web pages with WebBrowser control

3. Saving a complete Web Page from the WebBrowser control

4. Webbrowser control - Saving a web page

5. new problem of webbrowser control save web page

6. webbrowser control save web page

7. Saving Pages Using the WebBrowser Control ???

8. Saving Pages Using the WebBrowser Control ???

9. WebBrowser Ctl: save web page to local machine

10. Save WebBrowser's web page

11. Help saving web page with web control?

12. How to automatically save the entire web page *with images*

 

 
Powered by phpBB® Forum Software