eXpress Open Architecture Reference
×
Menu
Index

IExpressEntity::SearchParentInterface

 
This 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

 
C++
 
 
HRESULT SearchParentInterface(
                REFIID riid, IDispatch *SearchParentInterface
);
 
 

Parameters

 
This 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 value

 
This method returns S_OK if the enumerator object is successfully instantiated or there are no connections. Other possible values include the following.
 
Return code
Description
E_OUTOFMEMORY
Insufficient memory is available for the operation.
OLE_E_ADVISENOTSUPPORTED
Advisory notifications are not supported by this object.
 

Remarks

 
This 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 Code

 
The 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