Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does Firefox support calling COM objects?

146 views
Skip to first unread message

v...@ausi.com

unread,
Sep 22, 2006, 12:01:42 AM9/22/06
to
(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?

Thanks!
Victor

eric...@yahoo.com

unread,
Sep 22, 2006, 12:38:10 AM9/22/06
to dev-ext...@lists.mozilla.org
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.

Thanks!
Victor

_______________________________________________
dev-extensions mailing list
dev-ext...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-extensions


v...@ausi.com

unread,
Sep 22, 2006, 3:19:14 PM9/22/06
to
eric...@yahoo.com wrote:
> 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.

Eric, thank you for your answer.

I can write in C/C++ (using the Win32 AIP) without any problem.
However, I have no clue where to get the information for writing a
*Firefox extension* in C/C++.

I found the following link, but it seems that it only referes
JavaScript or some other scripting language?

Where can I find the right documentation for how to write a C/C++
extension (I prefer C++)?

A tutorial would be even better.

Thanks,
Victor

v...@ausi.com

unread,
Sep 22, 2006, 3:21:04 PM9/22/06
to
Oops... I forgot the link. Here it is:

http://www.borngeek.com/firefox/toolbar-tutorial/

eric...@yahoo.com

unread,
Sep 22, 2006, 4:51:15 PM9/22/06
to dev-ext...@lists.mozilla.org
>I have no clue where to get the information for writing a *Firefox extension* in C/C++
Neither do I. If you find out, please post it here. Consider asking in irc.mozilla.org #extdev

Nickolay Ponomarev

unread,
Sep 22, 2006, 6:20:13 PM9/22/06
to v...@ausi.com, dev-ext...@lists.mozilla.org
You should to write an XPCOM component in C++ - it will talk to the
COM component and will be accessible to JS code via XPConnect.

There is a book, Creating XPCOM Components, available online, as well
as quite a few articles on the topic, including
http://www.iosart.com/firefox/xpcom/ and
http://developer.mozilla.org/en/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System

Nickolay

v...@ausi.com

unread,
Sep 24, 2006, 11:11:16 PM9/24/06
to
Nickolay Ponomarev wrote:
> > Where can I find the right documentation for how to write a C/C++
> > extension (I prefer C++)?
> >
> You should to write an XPCOM component in C++ - it will talk to the
> COM component and will be accessible to JS code via XPConnect.
>
> There is a book, Creating XPCOM Components, available online, as well
> as quite a few articles on the topic, including
> http://www.iosart.com/firefox/xpcom/ and
> http://developer.mozilla.org/en/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System
>

Nickolay, thank you so much for your answer. Your answer looks like
exactly what I was looking for. Now I have a lot of learning to do...
Thanks again.

Victor

0 new messages