Monday, September 18, 2006

XPCOM

For those who want to create some plugin for Firefox/Mozilla written in C++ i recommend
the following example as a good start.

http://www.iosart.com/firefox/xpcom/

Download the stable mozilla development environment named Gecko from mozilla.org gecko-sdk-i586-pc-cygwin-1.7.6.zip

Download two additional libraries libIDL-0.6.3-win32-bin.zip and vc71-glib-1.2.10-bin.zip from mozilla.org libIDL-0.6.3-win32-bin.zip and vc71-glib-1.2.10-bin.zip
Extract libIDL-0.6.dll from libIDL-0.6.3-win32-bin.zip and put it into C:\gecko-sdk\bin

ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32

C:> unzip libIDL-0.6.3-win32-bin.zip
C:> copy libIDL-0.6.dll C:\gecko-sdk\bin
extract glib-1.2.dll from vc71-glib-1.2.10-bin.zip and put it into C:\gecko-sdk\bin
C:> unzip vc71-glib-1.2.10-bin.zip
C:> copy glib-1.2.dll C:\gecko-sdk\bin

Note that to build the sample you will need VS6 + SP4 or greater, you will need cygwin in order to build nspr library and be able to use an autoconf based make system now used. Cygwin for Windows Platform can be found here http://sources.redhat.com/cygwin/ where as nspr source code can be found here http://www.mozilla.org/projects/nspr/eng-process/build.html
You should be able to build nspr yourself with MSDEV6, with the command line tools and cygwin.

The only thing you need that's not part of MSDEV or cygwin is the binary nsinstall.exe which is available from http://www.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip

If you don't want to build the nsrp library you can just grab the binaries from here
http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/
but i strongly recommend jsut to rely on the latest gecko SDK. For firefox 1.5 take the
gecko 1.8b1 sdk otherway you will see some strange error such as TypeError Component[cid] has no properties and no interface can be expanded in XPCOM Viewer for your component.

Replace old library in the Sample project by the latest one libnspr4.lib libplds4.lib libplc4.lib

And off course remember that all your script will be server/client based driven.
For Mozilla/Firefox you will use XPCOM and for Internet Explorer you will use ACTIVE X control for custom Dialog call from script.

To view if your XPCOM has been properly deployed and install in Mozilla 1.5 http://xpcomviewer.mozdev.org/

To debug you XPCOM http://xulfr.org/wiki/XulRunner

Nice plugin sample to provide abstraction for all Media Player
http://www.foxytunes.com/

--
Thomas

No comments: