Archis

I wanted to know if there's any way to retrieve the actual "image" as such in a BHO.

I want to add functionality such as "Save to folder" or "send by email" for images through my BHO.

However, after quite a bit of searching, I don't seem to get the actual image "data" as such. I either need the image's file saved in IE's cache or some sort of binary blob which I should be able to save.

I tried the

RetrieveUrlCacheEntryFile

from wininet.dll but either I'm not getting it right in managed code through the pinvoke thingy, or I'm using it wrong, but it's returning the file-not-found error code for each call.

Any suggesstions



Re: Internet Explorer Extension Development How to get image or picture data?

Sharath Udupa - MSFT

Your suggested method should work. I tried this using the sample helloworld bho. After DocumentComplete, I got all IHTMLImgElement from IHTMLDocument2, then used the get_src for the URL and passed it to RetrieveUrlCacheEntryFile which successfully returned the file name in the IE cache. This was in C++ though.



Re: Internet Explorer Extension Development How to get image or picture data?

Archis

Thanks a lot. Sometimes, it gets very confusing to figure out exactly what goes wrong in a program, especially since I've never worked with COM Interop. At least now I know it's my P/Invoke that's going wrong. Appreciate your help a lot!





Re: Internet Explorer Extension Development How to get image or picture data?

eduyu

thank you. Sharath. Smile



Re: Internet Explorer Extension Development How to get image or picture data?

eduyu

but...

how can i save the image, if the image is not cached





Re: Internet Explorer Extension Development How to get image or picture data?

vipul.solanki

Hi Archis,
Can you please post the code to call RetrieveUrlCacheEntryFile() with interop definitions
The interop definitions of INTERNET_CACHE_ENTRY_INFO will help a lot.

Vipul




Re: Internet Explorer Extension Development How to get image or picture data?

chacham16

Was there any solution to your question



Re: Internet Explorer Extension Development How to get image or picture data?

Rene76

Hi,

Im also looking for a solution to get non-cached images (normally these are dynamic generated images).

Is there a way to get an object reference to images displayed in axwebbrowser, and from this -save it.

Kinda like right clicking on a picture in IE, and if the picture isnt cached it will promt to save it as unknown.bmp

/Rene





Re: Internet Explorer Extension Development How to get image or picture data?

Adrian Dorache

You could query for IHTMLElementRender interface and then call DrawToDC to paint the image into a memory DC. Having the image in a memory DC, is then easy to save it to disk.