?
Solved

How to comunicate between zwo ActiveX Controls

Posted on 1998-06-19
10
Medium Priority
?
373 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)
0
Comment
Question by:Hugi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1408196
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.
0
 

Author Comment

by:Hugi
ID: 1408197
But how can I get the pointer to the moniker on the Object (Parameter i need for calling GetObject)
0
 

Author Comment

by:Hugi
ID: 1408198
But how can I get the pointer to the moniker on the Object (Parameter i need for calling GetObject)
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:Hugi
ID: 1408199
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...
0
 
LVL 23

Expert Comment

by:chensu
ID: 1408200
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);

0
 
LVL 23

Expert Comment

by:chensu
ID: 1408201
0
 

Author Comment

by:Hugi
ID: 1408202
I think, the anser of thui was better, but I don't know how to implement.
0
 

Author Comment

by:Hugi
ID: 1408203
Question specification: I need informations about using the IRunningObjectTable (Register, GetObject and how to get the pointer to the Moniker)
0
 

Accepted Solution

by:
ERGO earned 600 total points
ID: 1408204
Try this:
void CConnectCtrl::Connect()
{
      LPRUNNINGOBJECTTABLE lpRot;
      LPENUMMONIKER lpEnumMoniker;
      LPMONIKER lpRunningMoniker;      
      LPUNKNOWN lpUnk;
      DWORD dwCookie;

      GetRunningObjectTable(NULL, &lpRot);
      lpRot->EnumRunning(&lpEnumMoniker);

      while(lpEnumMoniker->Next(1, &lpRunningMoniker, NULL) == S_OK)
      {
            if(SUCCEEDED(lpRot->GetObject(lpRunningMoniker, &lpUnk)))
            {
                  LPCONNECTIONPOINTCONTAINER lpConnPtCont;

                  // Is this object a connection point container?
                  if (SUCCEEDED(lpUnk->QueryInterface(IID_IConnectionPointContainer,
                              (LPVOID*)&lpConnPtCont)))
                  {
                        ASSERT(lpConnPtCont != NULL);
                        LPCONNECTIONPOINT lpConnPt = NULL;
                        
                        // We implement IID_IEventNotify.  Is this the interface that the
                        // connection point is looking for?
                        if (SUCCEEDED(lpConnPtCont->FindConnectionPoint(IID_IEventNotify, &lpConnPt)))
                        {
                              LPUNKNOWN lpUnk2;
                              HRESULT hr;
                              lpUnk2=m_Event.GetInterface(&IID_IUnknown);
                              hr=lpConnPt->Advise(lpUnk2,&dwCookie);
                              lpUnk2->Release();
                        }
                        lpConnPtCont->Release();
                  }
                  lpUnk->Release();
            }
            lpRunningMoniker->Release();
      }
      lpEnumMoniker->Release();
      lpRot->Release();
      m_eventMessage = "ConnectionDone";
}

m_Event is a member variable of type of your Dispatch Interface class.
0
 

Author Comment

by:Hugi
ID: 1408205
Thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question