Solved

Save images from WebBrowser/IHTMLDocument

Posted on 2003-11-14
3
1,219 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 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