ICoNtextNode::GetParentNode 方法

擷取內容節點樹狀結構中這個 ICoNtextNode 的父節點。

語法

HRESULT GetParentNode(
  [out] IContextNode **ppParentContextNode
);

參數

ppParentCoNtextNode [out]

這個 ICoNtextNode 物件的父節點指標。

傳回值

如需傳回值的描述,請參閱 類別和介面 - 筆跡分析

備註

警告

若要避免記憶體流失,當您不再需要使用父內容節點時,請在 *ppParentCoNtextNode上呼叫IUnknown::Release

如果這是根節點, ppParentCoNtextNode 參數會設定為 Null

範例

下列範例顯示可擷取指定節點及其 pCoNtextNode 參數相關資訊的協助程式方法。 這個協助程式方法會從下列方法傳回信息。

// Helper method for collecting information about a context node.
HRESULT CMyClass::GetNodeInformation(
    IContextNode *pContextNode,
    GUID *pNodeIdentifier,
    GUID *pContextNodeType,
    IAnalysisRegion **ppAnalysisRegion,
    IContextNode **ppParentNode,
    IContextNodes **ppSubNodes)
{
    // Get the identifier of the context node.
    HRESULT hr = pContextNode->GetId(pNodeIdentifier);

    if (FAILED(hr))
    {
        return hr;
    }

    // Get the type identifier for the context node.
    hr = pContextNode->GetType(pContextNodeType);

    if (FAILED(hr))
    {
        return hr;
    }

    // Get the location of the context node.
    hr = pContextNode->GetLocation(ppAnalysisRegion);

    if (FAILED(hr))
    {
        return hr;
    }

    // Get the parent node of the context node.
    hr = pContextNode->GetParentNode(ppParentNode);

    if (FAILED(hr))
    {
        if ((*ppAnalysisRegion) != NULL)
        {
            (*ppAnalysisRegion)->Release();
            (*ppAnalysisRegion) = NULL;
        }
        return hr;
    }

    // Get the subnodes of the context node.
    hr = pContextNode->GetSubNodes(ppSubNodes);

    if (FAILED(hr))
    {
        if (*ppAnalysisRegion)
        {
            (*ppAnalysisRegion)->Release();
            (*ppAnalysisRegion) = NULL;
        }
        if (*ppParentNode)
        {
            (*ppParentNode)->Release();
            (*ppParentNode) = NULL;
        }
        return hr;
    }

    return hr;
}

規格需求

需求
最低支援的用戶端
Windows XP Tablet PC Edition [僅限傳統型應用程式]
最低支援的伺服器
都不支援
標頭
IACom.h (也需要 IACom_i.c)
DLL
IACom.dll

另請參閱

ICoNtextNode

ICoNtextNode::GetSubNodes

筆跡分析參考