Metode IContextNode::GetParentNode

Mengambil simpul induk IContextNode ini di pohon simpul konteks.

Sintaks

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

Parameter

ppParentContextNode [out]

Penunjuk ke simpul induk objek IContextNode ini.

Menampilkan nilai

Untuk deskripsi nilai yang dikembalikan, lihat Kelas dan Antarmuka - Analisis Tinta.

Keterangan

Perhatian

Untuk menghindari kebocoran memori, panggil IUnknown::Release di *ppParentContextNode saat Anda tidak perlu lagi menggunakan simpul konteks induk.

Jika ini adalah simpul akar, parameter ppParentContextNode diatur ke NULL.

Contoh

Contoh berikut menunjukkan metode pembantu yang mengambil informasi tentang simpul tertentu, parameter pContextNode-nya . Metode pembantu ini mengembalikan informasi dari metode berikut.

// 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;
}

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung
Windows XP Tablet PC Edition [hanya aplikasi desktop]
Server minimum yang didukung
Tidak ada yang didukung
Header
IACom.h (juga memerlukan IACom_i.c)
DLL
IACom.dll

Lihat juga

IContextNode

IContextNode::GetSubNodes

Referensi Analisis Tinta