//
MozAxc


Update 12/27/03 ... see /EmbedInIE



Mozilla ActiveX Control.

Home page.

Purports to emulate the IE COM interfaces (for IE 4.0**), which should allow ClIEc to remote control MoZilla as well as Internet Explorer.

** "The interfaces for Internet Explorer 5.0 are considerably more complicated and I have not reached a decision whether I should attempt to implement them in Mozilla."

Not exactly. This is a Mozilla replacement for the IE WebBrowser control, not the whole browser.

This page has links to two things: InternetExplorer and WebBrowser. The former is the entire browser, the latter is the embeddable control that's the core of the browser.

So, registering the control below gives us a Mozilla.Browser COM instance to work with, but this won't be "Mozilla The Browser," it's a core control designed to be hosted in another application.

From the MozAxc author:
Here's the Ruby we'd like to be able to write:

require 'win32ole'

# Mozilla.Browser does not work
@moz = WIN32OLE.new('Mozilla.Browser.1')
@moz.gohome

You can't do this (not even with the IE control). Controls are tricky things to manage and you normally have to write a lot of code yourself, or use a language such as VB or C++ which has classes that do it for you. Generally you need to create a COM object called a control site that implements various COM interfaces and manages a control object - activating the control, sizing it and so on.

The approach you have above would only work for OLE automation objects which might include the likes of MS Word and possibly the IE browser *application*, but not the Mozilla or IE controls. The controls are DLLs which live in a window, not an executable that you can just create an instance of and remotely control from somewhere else.

So ... it might be possible to write an hosting application for the Mozilla control ... but what's the easy way to do this? Delphi would be a good choice, but it's not open.

The Mozilla control can be hosted in Internet Explorer with a simple web page, see /EmbedInIE for more info.

Another weird option would be to build out special ClIEc that would generate JavaScript that could be hosted in a special frame, driving another frame to test it.

This seems the most feasible (vs. building a special COM host for the MozAxc control that would allow Ruby to talk to MozAxc), but loses the ability to control Mozilla directly. The JavaScript would have to be generated and then executed in Mozilla separately.



W3C DOM Level 1 -- supported in Mozilla and MozAxc.



Interesting link to check out. Ruby bindings to the Mozilla XPCOM: http://rbxpcom.mozdev.org/


Installing

The Mozilla installer puts the necessary .dlls in your Common Files folder, under mozilla.org\gre\x, where x is your current version. The COM stuff ain't registered, though, so you've got to do it yourself.

The Mozilla .zip dist has the necessary files in the \bin directory.

From whatever directory has the mozctl.dll and mozctlx.dlls in it, go to a command prompt in that directory and type:

regsvr32.exe mozctlx.dll


Make sure you register mozctlX.dll, not plain ol' mozctl.dll

At this point, you can run this Ruby script to get an instance of the dealy going:

require 'win32ole'

@moz = WIN32OLE.new('Mozilla.Browser.1') # Mozilla.Browser does not work
@moz.gohome


Note that the version independent prog id doesn't work (dunno why, emailed author). You'll also find out very quickly that every single method you try to call against @moz will result in this COM error, "Browser is not in a valid state". (Tried with Moz 1.4 and 1.5rc2). I've also emailed the author about this issue to see what he can tell us.

The answer may be because we've not got a whole browser here, just a control intended to be embedded in something else (just a guess -- see above).

I've got a copy of Delphi handy, so I've tried the control with Delphi, and the home page says it should work.


| Email | Reload ? || Find | Recent | Home last update: Sun May 29 2005 08:00 AM