Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 3212

Nested COM interfaces

$
0
0

Are there any examples in C++ of nested COM interfaces?  All I can find are simple flat, eg a CoClass with a method to show a message and a property to change a string.  But real COM object models (like Excel's) are deeply hierarchic: Application.Object1.Object2.Text.Font.Size = 12.   If I make a parent property of an already-defined CoClass type, the hierarchy shows by code-completion in a Visual Studio VB.Net controller script, but nothing I try actually works (object is Null and other errors). Assuming this is the right thing to do, how to I complete the generated get_ and set_ to actually instantiate the child, so that its methods and properties can be called in turn? 

STDMETHODIMP TParentCCImpl::get_Property1(ChildCC** Value)
{
try
{
// what goes here?
}   catch(Exception &e)
{
   return Error(e.Message.c_str(), IID_IParentCC);
}
   return S_OK;
}
STDMETHODIMP TParentCCImpl::set_Property1(ChildCC* Value)
{
try
{
// what goes here?
}
catch(Exception &e)
{
   return Error(e.Message.c_str(), IID_IParentCC);
}
return S_OK;
} 

 

 


Viewing all articles
Browse latest Browse all 3212

Trending Articles