IExpressEntity::SearchParentInterfaceThis method attempts to return an pointer to the interface specified by looking through all the parent relationships accessible from this entity. It is most often used when a Design pointer is needed and the only interface available is, for example, a Port pointer.
Syntax
ParametersThis method attempts to return an pointer to the interface specified by looking through all the parent relationships accessible from this entity. It is most often used when a Design pointer is needed and the only interface available is, for example, a Port pointer.
Return valueThis method returns S_OK if the enumerator object is successfully instantiated or there are no connections. Other possible values include the following.
RemarksThis method is useful for searching all parent interfaces. It essentially walks successively through immediate parents using the IExpressEntity::Parent property until it finds the interface specified. In most cases, this behavior is desirable. If it is desirable to find out only if the immediate parent supports a given interface, the IExpressEntity::Parent property should be used instead.
Example CodeThe following example uses smart pointers assuming that a port interface is known.
#import "express.tlb"
MyFunction(eXpress::IPortPtr iPort)
{
using namespace eXpress;
IDesignPtr iDesign;
IExpressEntityPtr iEntity;
try
{
iEntity = iPort;
iDesign = iEntity->SearchParentInterface(__uuidof(IDesign));
}
catch (_com_error&) {}
// Now we can use iDesign to search for other things...
}
See Also |