Solved

Connection Application-ActiveX

Posted on 1998-07-08
6
262 Views
Last Modified: 2013-12-04
I tried to send an event from my Application to an ActiveX as follow, but the event newer touched my ActiveX - where can be the mistake?

void CSourceDoc::FireEventV(DISPID dispid, BYTE* pbParams,
      va_list argList)
{
      COleDispatchDriver driver;
      const CPtrArray* pConnections = m_xEventConnPt.GetConnections();
      ASSERT(pConnections != NULL);

      int i;
      int cConnections = pConnections->GetSize();
      LPDISPATCH pDispatch;
      for (i = 0; i < cConnections; i++)
      {
            pDispatch = (LPDISPATCH)(pConnections->GetAt(i));
            ASSERT(pDispatch != NULL);
            driver.AttachDispatch(pDispatch, FALSE);
            TRY
                  driver.InvokeHelperV(dispid, DISPATCH_METHOD, VT_EMPTY, NULL,pbParams, argList);
            END_TRY
            driver.DetachDispatch();
      }
}
0
Comment
Question by:Hugi
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1409635
Event is fired by the control to container, not vice versa. If you want to access control's property or method from container you can quere for an interface and then call its method.
0
 

Author Comment

by:Hugi
ID: 1409636
But I need access to the same instance of the interface and when I quere for an interface I get a new instance.
0
 
LVL 7

Expert Comment

by:galkin
ID: 1409637
I guess you're confused. When you create control with CoCreateInstance you get reference to IUnknown or ther interface you quere. OLe polymorphism states that you can quere any interface from any interface and get the same result. So you can quere the interface you are interested in and call its methods.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:Hugi
ID: 1409638
This might be OK when I just need a method, but when I want to connect to an other process, it doesn't works.
0
 

Accepted Solution

by:
ERGO earned 50 total points
ID: 1409639
Your code seems correct, check if you did the connection in your ActiveX
0
 
LVL 7

Expert Comment

by:galkin
ID: 1409640
If you want to call a method of custom interface of out of process server you need to implement marshaling to marshal call across process boundaries. If you call standard OLE inteface method i.e. IDispatch::Invoke, OLE already provides marshaling so you don't need to care.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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 …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now