如何提取webcontrol主机中img元素中的图片?

发布于 2024-07-11 03:34:03 字数 189 浏览 9 评论 0原文

我想从 html 页面中提取位图。 我希望从网页中获得的 IHTMLImgElement 中找到 IStream、IPersistStream 或 IPersistStreamInit。 但是我找不到其中任何一个。

我可以从缓存中读取图片,但这有点不可靠,我想避免从文件系统中读取。

是否有一些接口可以用来获取位图?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三岁铭 2024-07-18 03:34:03

使用 IHTMLElementRender。

在 IHTMLImgElement 上使用 QueryInterface,您应该能够获取指向 IHTMLElementRender 接口的指针,然后在内存 DC 中调用 DrawToDC。

当位图位于内存 DC 中时,有多种方法可以保存位图。

...

我实际上找到了一个示例,只需 g**gle 'IHTMLElementRender IHTMLImgElement "GDI+"'。

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+"'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文