IContextNode::GetStrokeCount-Methode

Ruft die Anzahl der Striche ab, die dem IContextNode-Objekt zugeordnet sind.

Syntax

HRESULT GetStrokeCount(
  [out] ULONG *pulStrokeCount
);

Parameter

pulStrokeCount [ out]

Die Anzahl der Striche, die dem IContextNode-Objekt zugeordnet sind.

Rückgabewert

Eine Beschreibung der Rückgabewerte finden Sie unter Klassen und Schnittstellen – Ink-Analyse.

Bemerkungen

Nur Ink-Blattkontextknoten verfügen über zugeordnete Strichdaten (siehe IContextNode::GetType).

Beispiele

Dieses Beispiel zeigt eine Methode, ExploreContextNode , die einen IContextNode untersucht. Die -Methode führt Folgendes aus:

  • Ruft den Typ des Kontextknotens ab.
  • Untersucht bestimmte Eigenschaften des Knotentyps durch Aufrufen einer Hilfsmethode, wenn der Kontextknoten ein nicht klassifizierter Ink-, Analysehinweis- oder benutzerdefinierter Recognizer-Knoten ist.
  • Untersucht jeden Unterknoten, indem er sich selbst aufruft, wenn der Knoten Überunterknoten hat.
  • Untersucht die Strichdaten für den Knoten durch Aufrufen einer Hilfsmethode, wenn der Knoten ein Ink-Blattknoten ist.
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;
}

Requirements (Anforderungen)

Anforderung Wert
Unterstützte Mindestversion (Client)
Windows Nur Desktop-Apps der XP Tablet PC Edition []
Unterstützte Mindestversion (Server)
Nicht unterstützt
Header
IACom.h (erfordert auch IACom _ i.c)
DLL
IACom.dll

Weitere Informationen

IContextNode

IContextNode::GetStrokeIds

IContextNode::GetStrokeId

Referenz zur Ink-Analyse