We help IT Professionals succeed at work.

How to comunicate between zwo ActiveX Controls

Medium Priority
390 Views
Last Modified: 2013-12-03
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)
Comment
Watch Question

Tommy HuiEngineer

Commented:
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.

Author

Commented:
But how can I get the pointer to the moniker on the Object (Parameter i need for calling GetObject)

Author

Commented:
But how can I get the pointer to the moniker on the Object (Parameter i need for calling GetObject)

Author

Commented:
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...

Commented:
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);

Author

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

Author

Commented:
Question specification: I need informations about using the IRunningObjectTable (Register, GetObject and how to get the pointer to the Moniker)
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.