Link to home
Start Free TrialLog in
Avatar of Hugi
Hugi

asked on

How to comunicate between zwo ActiveX Controls

I start the IE4 by using IWebBrowser Interface from my Application witch is an ActiveX. The WebBrowser contains an ActiveX Object witch has to communicate with my Application. How can I do that? (Please give me an example)
Avatar of Tommy Hui
Tommy Hui

For any object that needs to communicate with another, the best way to do that is to register itself with the IROT (IRunningObjectTable). Then other objects can detect if you're there or not by calling IRunningObjectTable::GetObjet().

One you have the interface, you can query it for any other interfaces you have defined for that communication.
Avatar of Hugi

ASKER

But how can I get the pointer to the moniker on the Object (Parameter i need for calling GetObject)
Avatar of Hugi

ASKER

But how can I get the pointer to the moniker on the Object (Parameter i need for calling GetObject)
Avatar of Hugi

ASKER

Message to thui: Sorry, I'm a new user of this tool. Your anser was not bad but I need an example, how to implement. Maybe it was wrong to open the question for other users...
The following content is from

ActiveX SDK FAQ
Frequently Asked Questions on Developing with the ActiveX SDK
Last updated: October 16, 1996




How do I access IE's object model from a contained control?

IE supports an Automation interface called IWebBrowserApp. It also supports an object model for scripting through a hierarchy of interfaces, the root of which is IHTMLDocument. The IHTMLDocument interface has one property, Script, which returns the dispinterface for the IOmWindow interface. This corresponds to the window object described in the ActiveX SDK documentation. From a contained control or doc object, you can get the dispinterface for IWebBrowserApp with the following code:


IOleClientSite* pClientSite; // already points to the control's client site
IServiceProvider* pISP;
IDispatch* pIEIDisp;


pClientSite->QueryInterface(IID_IServiceProvider, (void **)&pISP);
pISP->QueryService(IID_IWebBrowserApp, IID_IDispatch, (void **)&pIEIDisp);


To get the dispinterface for IHTMLDocument, given that you already have the ISP pointer as above, you can use this code:


IDispatch* pScriptIEDisp;
pISP->QueryService(SID_SContainerDispatch, IID_IDispatch, (void**)&pScriptIEDisp);

Avatar of Hugi

ASKER

I think, the anser of thui was better, but I don't know how to implement.
Avatar of Hugi

ASKER

Question specification: I need informations about using the IRunningObjectTable (Register, GetObject and how to get the pointer to the Moniker)
ASKER CERTIFIED SOLUTION
Avatar of ERGO
ERGO

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hugi

ASKER

Thanks