views:

233

answers:

1

I would like to extract a bitmap from an html page. I expected to find a IStream, IPersistStream or IPersistStreamInit from the IHTMLImgElement I got in the web page. However I can't found any of those.

I could read the picture from the cache but this is somewhat unreliable and I would like to avoid reading from the filesystem.

Is there some interface I could use to get the bitmap ?

A: 

Use IHTMLElementRender.

Using QueryInterface on your IHTMLImgElement you should be able to get a pointer to the IHTMLElementRender interface, then call DrawToDC in a memory DC.

There are several ways to save a bitmap when it's in a memory DC.

...

I've actually found a sample, just g**gle 'IHTMLElementRender IHTMLImgElement "GDI+"'.