Metodo IContextNode::GetSubNodes

Ottiene i nodi figlio diretti dell'oggetto IContextNode .

Sintassi

HRESULT GetSubNodes(
  [out] IContextNodes **ppSubContextNodes
);

Parametri

ppSubContextNodes [out]

Raccolta degli oggetti IContextNode che sono nodi figlio diretti di questo 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 *ppSubContextNodes quando non è più necessario usare la raccolta di sottonodi.

Restituisce solo i nodi figlio diretti, non tutti i nodi discendenti.

Esempio

Questo esempio mostra un metodo, , ExploreContextNodeche esamina un IContextNode. Il metodo esegue le operazioni seguenti:

  • Ottiene il tipo del nodo di contesto.
  • Esamina le proprietà specifiche del tipo di nodo chiamando un metodo helper, se il nodo di contesto è un input penna non classificato, un hint di analisi o un nodo di riconoscimento personalizzato.
  • Esamina ogni sottonode chiamando se stesso, se il nodo ha sottonodi.
  • Esamina i dati del tratto per il nodo chiamando un metodo helper, se il nodo è un nodo foglia penna.
HRESULT CMyClass::ExploreContextNode(
    IContextNode *pContextNode)
{
    // Check for certain types of context nodes.
    GUID ContextNodeType;
    HRESULT hr = pContextNode->GetType(&ContextNodeType);

    if (SUCCEEDED(hr))
    {
        if (IsEqualGUID(GUID_CNT_UNCLASSIFIEDINK, ContextNodeType))
        {
            // Call a helper method that explores unclassified ink nodes.
            hr = this->ExploreUnclassifiedInkNode(pContextNode);
        }
        else if (IsEqualGUID(GUID_CNT_ANALYSISHINT, ContextNodeType))
        {
            // Call a helper method that explores analysis hint nodes.
            hr = this->ExploreAnalysisHintNode(pContextNode);
        }
        else if (IsEqualGUID(GUID_CNT_CUSTOMRECOGNIZER, ContextNodeType))
        {
            // Call a helper method that explores custom recognizer nodes.
            hr = this->ExploreCustomRecognizerNode(pContextNode);
        }

        if (SUCCEEDED(hr))
        {
            // Check if this node is a branch or a leaf node.
            IContextNodes *pSubNodes = NULL;
            hr = pContextNode->GetSubNodes(&pSubNodes);

            if (SUCCEEDED(hr))
            {
                ULONG ulSubNodeCount;
                hr = pSubNodes->GetCount(&ulSubNodeCount);

                if (SUCCEEDED(hr))
                {
                    if (ulSubNodeCount > 0)
                    {
                        // This node has child nodes; explore each child node.
                        IContextNode *pSubNode = NULL;
                        for (ULONG index=0; index<ulSubNodeCount; index++)
                        {
                            hr = pSubNodes->GetContextNode(index, &pSubNode);

                            if (SUCCEEDED(hr))
                            {
                                // Recursive call to explore the child node of this
                                // context node.
                                hr = this->ExploreContextNode(pSubNode);
                            }

                            // Release this reference to the child context node.
                            if (pSubNode != NULL)
                            {
                                pSubNode->Release();
                                pSubNode = NULL;
                            }

                            if (FAILED(hr))
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        // This is a leaf node. Check if it contains stroke data.
                        ULONG ulStrokeCount;
                        hr = pContextNode->GetStrokeCount(&ulStrokeCount);

                        if (SUCCEEDED(hr))
                        {
                            if (ulStrokeCount > 0)
                            {
                                // This node is an ink leaf node; call helper
                                // method that explores available stroke data.
                                hr = this->ExploreNodeStrokeData(pContextNode);
                            }
                        }
                    }
                }
            }

            // Release this reference to the subnodes collection.
            if (pSubNodes != NULL)
            {
                pSubNodes->Release();
                pSubNodes = NULL;
            }
        }
    }

    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::GetParentNode

Informazioni di riferimento per l'analisi dell'input penna