3

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.

  1. I couldn't understand the way to place an image inside the plugin area. Can someone provide example?

  2. How do I place a DirectX object there? Any example?

  3. How do I trigger automatic installation?

Thanks!

Sara

sara
  • 3,824
  • 9
  • 43
  • 71
  • You will need ActiveX technology to write an IE plugin. This can be written in almost any MS developer tool. Directx is a trickier question. Directly interacting the DX API will be very difficult to say the least. (But there are some frontends to DX, have to check out the tools you are familiar with). – vbence May 28 '11 at 21:26
  • FireBreath handles the ActiveX layer transparently, which makes it much simpler. – taxilian May 31 '11 at 15:09

2 Answers2

9

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.

Community
  • 1
  • 1
taxilian
  • 14,229
  • 4
  • 34
  • 73
  • Oh; on the question of automatic installation, that's not an easy problem to solve. My solution is to simply not do it; instead, I use javascript to detect if the plugin is there and prompt them to download it. If that's not good enough, you could package it inside an XPI for Firefox, CRX for Chrome, and CAB for IE. Only the CAB can be used to install for all browsers, the others will be browser specific. The msi installer that I have them download installs for all browsers. – taxilian May 27 '11 at 22:46
  • I don't understand- will the CAB install for all the browsers? So why your solution is not to use it? Can you provide a link to a cab good tutorial? – sara May 29 '11 at 08:52
  • I would like to try the chat, but I work form other country- time diffrences... so I'll try to summarize the problem- I got the HWND, created a thread, passed is as a paramm copied my DirectX code. All is fine... but- nothing is shown in the window. I think it is because I didn't handle the RefreshEvent- How do I do it in FireBreath? My normal windows code won't do... – sara May 29 '11 at 13:30
  • CAB will install for all browsers, but it can only be used in IE. It also requires a page refresh, though some of the other options (not the MSI) require a full page reload. – taxilian May 30 '11 at 16:19
  • You created the thread, but did you create a render loop inside the thread? You have to tell it to actually draw in the HWND for it to do so. Handling the RefreshEvent is as simple as adding another line to the event map and a function to handle it, then in some way send a message to the other thread and tell it to draw. You could use a queue and condition variables, FB::SafeQueue, or any number of other ways to post the message to your render thread, but that's really a different question about how to do safe cross-thread communication. – taxilian May 30 '11 at 16:21
  • You did answer the question, but can you please help me with http://stackoverflow.com/q/6109545/487305? I can't proceed until this problem is solved. – sara May 31 '11 at 08:30
  • This is difficult, I need to work on plugins, is there any simple way to do it. – Johnydep Jun 01 '11 at 17:53
  • Plugins are tricky beasts. Things are *far* easier with FireBreath than doing it from scratch, but it still requires some learning – taxilian Jun 01 '11 at 22:33
  • I do need the installation to be automatic. Can you provide links to XPI, CRX and CAB good tutorials? – sara Jun 02 '11 at 12:17
  • I don't know of any; there is some information on FireBreath.org at http://www.firebreath.org/display/documentation/Deploying+and+updating+your+plugin, but I don't know of any specific tutorials. I really think you'll regret going down that path if you decide to do so -- it gives you 4 different mediocre installers that you have to maintain and 4x more likely things will go wrong. Still, at least you know what to look for. Sorry I can't help more. – taxilian Jun 02 '11 at 18:26
0

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)

Paul Verest
  • 60,022
  • 51
  • 208
  • 332