Solved

Save images from WebBrowser/IHTMLDocument

Posted on 2003-11-14
3
1,215 Views
Last Modified: 2009-07-29
Hi,
I'm writing an application that uses a WebBrowser control to save webpages for offline reading. I am able to get at the html source fine and save that, but getting the images is proving to be tricky. Currently, I get a list of the of images from the Document property, by looping through each IHTMLImgElement in the Document.Images element collection. That gives me the name and the final url for the image, so I use a WebRequest to download the image.

I feel there is a better way to get these images. The WebBrowser control has already downloaded these images to display them and I don't like having to download each image twice, it seems like a big waste of resources. Is there anyway to get each image from the WebBrowser control, by extracting it from the DOM or something?

Anyone who can point me to an MSDN or other article on how to extract this information, or provides a code example will get the points.

Thanks
0
Comment
Question by:fieldofasphodel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9754302
Yes, since you already downloaded the images you can get them from the browser cache.
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 500 total points
ID: 9754395
Here is a link:
http://www.graphcomp.com/info/specs/ms/inetr007.htm

But when you don't explicitly bypass the cache you should get it from the cache anyway.
0
 

Author Comment

by:fieldofasphodel
ID: 9765373
Thanks, this will help out a lot. I'd rather explicitly get my images from the cache, it's very important to my project that I don't get the image from the server twice. Using this rather than assuming my WebRequest is getting cached images gives me that reassurance.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question