COM Object returning COM Object Reference 
Author Message
 COM Object returning COM Object Reference

I have been able to build a model of what I need to do using VB
components...but unsuccessful when attempting to use ATL which is required
since the one component must run as a System Service.  I am looking for an
ATL sample that would demonstrate how to do the following:

I have an ActiveX.exe which instantiates a COM object. (Call it ObjectA)
It exposes a property which is the reference to the COM object. (call it
ObjectB)
You have a VB client which instantiates the ActiveX.exe (ObjectA).

Thus the client can say something like:
Dim MyObjectA as New ObjectA
Dim MyObjectB as ObjectB

Set MyObjectB=MyObjectA.ObjectB
msgbox MyObjectB.somemethod

When attempting to implement ObjectA in ATL we always end up with the
ObjectB property returning an Automation Error.

Any and all suggestions and pointers to a sample bit of code greatly
welcomed and appreciated.

Happy Holidays



Fri, 11 Jun 2004 02:18:44 GMT  
 COM Object returning COM Object Reference
What is the IDL declaration for that property? It must look like:

[propget, id(xxx)]
HRESULT ObjectB([out, retval] IObjectB **ppVal);

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> I have been able to build a model of what I need to do using VB
> components...but unsuccessful when attempting to use ATL which is required
> since the one component must run as a System Service.  I am looking for an
> ATL sample that would demonstrate how to do the following:

> I have an ActiveX.exe which instantiates a COM object. (Call it ObjectA)
> It exposes a property which is the reference to the COM object. (call it
> ObjectB)
> You have a VB client which instantiates the ActiveX.exe (ObjectA).

> Thus the client can say something like:
> Dim MyObjectA as New ObjectA
> Dim MyObjectB as ObjectB

> Set MyObjectB=MyObjectA.ObjectB
> msgbox MyObjectB.somemethod

> When attempting to implement ObjectA in ATL we always end up with the
> ObjectB property returning an Automation Error.

> Any and all suggestions and pointers to a sample bit of code greatly
> welcomed and appreciated.

> Happy Holidays



Mon, 14 Jun 2004 03:39:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Return a pointer to a nested COM object from a COM object method

2. Invoking COM object from COM object

3. passing COM object pointers to another COM object in ATL

4. COM object in a COM object

5. Passing COM objects as parameters to other COM objects

6. C++ COM-Object with COM-Object as parameter

7. Creating COM objects from COM objects

8. Problem with scripting context when using VB com object inside VC com object

9. Passing COM objects as parameters to other COM objects

10. Using COM objects within COM objects

11. Question: ATL COM object reference

12. Understanding reference counts on com objects passed across processes

 

 
Powered by phpBB® Forum Software