I am creating a COM object using Visual Studio 2008 and ATL. Adding simple properties and methods is easy enough but now I want to do something more complicated. I want to give access to a C++ object via a property of my COM object, so I can do something like:
// Pseudo-code
var obj = CreateObject("progid");
obj.aProperty.anotherProperty = someValue;
So, aProperty
returns a reference to another object which exposes a property called anotherProperty
.
I'm guessing that I need to add another simple ATL object to my project for the second object (call it IClass2
), and have something like the following in the IDL:
[propget, id(1)] HRESULT aProperty([out, retval] IClass2** ppValue);
Am I on the right track here? Does anyone know of a good tutorial for this sort of thing?