tags:

views:

541

answers:

1

I wrote a Firefox plugin (only compatible with FF3 atm) that allows the hosting of ActiveX controls.
Before the flaming begins - this is not the main topic for this question and the plugin was designed with security in mind so it doesn't break my favorite browser. if you are interested, it's hosted at http://code.google.com/p/ff-activex-host/.

Now, I've noticed that in IE all ActiveX controls have an event called OnReadyStateChange available, however, not all ActiveX controls have that event listed in their TypeLib. As a result, my plugin cannot register handlers for this event for every ActiveX control.

Opening such controls with OleView, I can't find the OnReadyStateChange event either - leading me to believe that IE might be 'cheating' here to make it work. When OleView shows such a handler (as with the Shockwave ActiveX control), I have no troubles registering handlers for it.

An example of such a control is Microsoft's Terminal Services ActiveX. But it's not a problem limited to MS ActiveX controls.

I am not an expert on COM Objects, am I searching for the event in a wrong way or at the wrong place?
Right Now I think I'm doing it right, since OleView can't find it either, so...

Can I somehow 'cheat' the same way IE does and make this event available anyway?

+2  A: 

Yes IE will be cheating. What you actually have in IE is what in the COM world we call an aggregate object. IE will have create an instance of a COM class that it uses to represent ActiveX objects and will aggregate that with the actual instance of the ActiveX class, creating a composite object.

This composite appears to be a single object with new features.

Hence I don't think you need worry about OnReadyStateChange at all.

AnthonyWJones
Thanks! I'd also appreciate it if you could point me in the general direction of what I would need to do to implement such an aggregate myself. It's hard to find anything on the msdn unless you have the name of an API call to start with.
Leeor Aharon
See http://support.microsoft.com/kb/173823.
AnthonyWJones