Metodo IContextNode::GetParentNode

Recupera il nodo padre di questo IContextNode nell'albero dei nodi del contesto.

Sintassi

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

Parametri

ppParentContextNode [out]

Puntatore al nodo padre di questo oggetto IContextNode .

Valore restituito

Per una descrizione dei valori restituiti, vedere Classi e interfacce - Analisi input penna.

Commenti

Attenzione

Per evitare una perdita di memoria, chiamare IUnknown::Release in *ppParentContextNode quando non è più necessario usare il nodo contesto padre.

Se si tratta del nodo radice, il parametro ppParentContextNode è impostato su NULL.

Esempio

Nell'esempio seguente viene illustrato un metodo helper che recupera informazioni su un nodo specificato, il relativo parametro pContextNode . Questo metodo helper restituisce informazioni dai metodi seguenti.

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

Requisiti

Requisito Valore
Client minimo supportato
Windows XP Tablet PC Edition [solo app desktop]
Server minimo supportato
Nessuno supportato
Intestazione
IACom.h (richiede anche IACom_i.c)
DLL
IACom.dll

Vedi anche

IContextNode

IContextNode::GetSubNodes

Informazioni di riferimento per l'analisi dell'input penna