You can do this by writing your extension in C/C++ and using standard Win32 API calls to instantiate the COM object (CoCreateInstance()) in the button click's event handler. By the way, you might find the source of the Firefox ActiveX plug-in (not extension) interesting, although I haven't looked at it myself.

----- Original Message ----
Sent: Friday, September 22, 2006 12:01:42 AM
Subject: Does Firefox support calling COM objects?

(COM as in Microsoft's "Component Object Model")

I would like to add a button to Firefox that upon clicking, will call
an "Interface Method" in a COM DLL I am writing (sorry for the
Microsoft jargon, I hate it too).

In Internet Explorer, the way to do that is this: First implement
IObjectWithSite on said COM object. Soon after creation, SetSite will
be called on it and given an IUnknown pointer. Query this pointer for
IServiceProvider, call QueryService(SID_SWebBrowserApp), and you will
get back IWebBrowser2 pointer referring to the browser instance where
the button was clicked.

But in Firefox I have no idea how to even begin to do that (if possible
at all). Any idea where to start from? Is there something equivalent to
IWebBrowser2 in Firefox? Or anything that upon clicking a custom button
will call a COM interface?


dev-extensions mailing list