
Initialize a Full Control in a browser from a Composite Control
Are you saying that your composite control hosts WebBrowser, and you
navigate this browser to a page that creates another control via
<object> tag? First, you need to wait until WebBrowser fires
DocumentComplete event - at this point you know that the HTML page is
processed and the control is instantiated. Get the document object with
IWebBrowser2::get_Document. Now you have two ways to proceed.
You can query the document object for IOleContainer and call
EnumObjects. This gives you all ActiveX controls embedded on a page.
Query each for the interface you know your control implements. Once QI
succeeds, you have found your control.
Or, use DHTML interfaces to get to IHTMLObjectElement corresponding to
your <object> tag. E.g. if you know an ID of your object, you can use
document.all.item("myId"). Once there, use
IHTMLObjectElement::get_object to get the interface to your control.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Quote:
> Hello,
> I created a full control ActiveX in a browser from a
> composite control in another browser by using "Navigate2".
> (The ActiveX is embed in the browser)
> I want to initialize and assign attributes to this full
> control from the composite control. How can I get the
> control of this full control ? It seems that it will
> create another instance if I use "CoCreateInstance".
> Can someone tell me how can I get the control from this
> new browser?
> Thank you
> David