如何为 IE、Firefox 和 Chrome 编写网络浏览器插件
我需要编写一个支持 IE 7+、Firefox 3+、Chrome 的网络浏览器插件。
该插件必须能够将 DirectX 对象放置在网页中。
我没有使用插件的经验。
我做了一些调查并决定使用 FireBreath 来实现。
我无法理解如何将图像放置在插件区域内。有人可以提供示例吗?
如何在那里放置 DirectX 对象?有什么例子吗?
如何触发自动安装?
谢谢!
莎拉
I need to write a web browser plugin that supports IE 7+, Firefox 3+, Chrome.
This plugin has to be able to place a DirectX object in a web page.
I have no experience with plugins.
I did some investigating and decided to do it with FireBreath.
I couldn't understand the way to place an image inside the plugin area. Can someone provide example?
How do I place a DirectX object there? Any example?
How do I trigger automatic installation?
Thanks!
Sara
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,有两个问题你必须解决。在这一点上,理解插件确实更容易,因为 FireBreath 可以帮助您。天哪,无论是谁写的,一定很聪明! (好吧,是我,所以我不得不这么说)
首先要理解的是,您不能将“DirectX 对象”“放置”在任何地方。您不会将图像“放置”在插件内。相反,您可以像在任何其他 Windows 应用程序中一样将图像绘制到窗口中。
您可能想提取我对另一个类似问题的回答:浏览器插件中的Directx控件
在 Windows 上的普通插件实例(“窗口”插件)中,您将获得一个可以绘制的 HWND。您需要在该窗口中设置 DirectX 上下文并绘制到它 - 无论是按照应用程序需要的帧速率还是仅在 RefreshEvent 到来时绘制。如果您点击有关的链接,您将看到 colonelpanic.net 上有关在 Windows 中绘图的帖子的链接;这应该可以帮助您更好地了解如何获得 HWND。
图片基本一致;如果您有图像数据,则可以使用普通的 Windows 绘图 API 将其绘制到 HWND。
最后,如果您需要其他帮助,我强烈建议您进入 FireBreath IRC 聊天室。我通常在工作日的白天(GMT-0600)在场,有时也有其他人可以提供帮助。
Well, there are two problems you have to solve. Understanding of plugins is really the easier one at this point, since have FireBreath to help you. Gosh, whoever wrote that must have been brilliant! (okay, it was me, so I had to say it)
The first thing to understand is that you don't "place" a "DirectX object" anywhere. You don't "place" an image inside the plugin. Rather, you draw the image to a window just like in any other windows application.
You may want to pull up my answer to another similar question: Directx control in browser plugin
In a normal plugin instance on windows (a "windowed" plugin) you will be given an HWND that you can draw to. You need to set up a DirectX context in that window and draw to it -- either at framerate that your application needs or just when a RefreshEvent comes. If you follow the link about you'll see a link to a post on colonelpanic.net on drawing in windows; that should help you understand better how you get the HWND.
Images are basically the same deal; if you have image data, you can draw it to the HWND using normal windows drawing APIs.
Finally, if you need additional help I highly recommend you pop into the FireBreath IRC chat room. I'm usually around during daylight hours (GMT-0600) on weekdays and there are others who can sometimes help as well.
截至 2021 年,有方法制作可在 Chrome、Firefox、Safari 中运行的插件,请参阅 适用于 Chrome、Firefox、Safari 标准参考和工具的 Web 扩展(浏览器插件)(2021)
As of 2021 there is way to make plugins that will work in Chrome, Firefox, Safari, see Web Extension (browser plugin) for Chrome, Firefox, Safari standard reference and tools (2021)