IInkAnalyzer::GetRecognizedString method

Retrieves the best-result string of the recognition operation for the entire context node tree in the IInkAnalyzer.

Syntax

HRESULT GetRecognizedString(
  [out] BSTR *pbstrRecognizedString
);

Parameters

pbstrRecognizedString [out]

The best-result string of the recognition operation for the entire context node tree in the IInkAnalyzer.

Return value

For a description of the return values, see Classes and Interfaces - Ink Analysis.

Remarks

Caution

To avoid a memory leak, call SysFreeString for pbstrRecognizedString when you no longer need to use the string.

This method returns the same value as the root node's property data for the recognized string. (See IInkAnalyzer::GetRootNode Method, IContextNode::GetPropertyData, and Context Node Properties.)

Examples

The following example shows a method that walks the ink analyzer's IContextNode results tree. If the IInkAnlyzer is not currently performing ink analysis, the method does the following.

  • Gets the top recognition string.
  • Gets the ink analyzer's root node.
  • Calls a helper method, ExploreContextNode, to examine the root node and its child nodes.
// Helper method that explores the current analysis results of an ink analyzer.
HRESULT CMyClass::ExploreAnalysisResults(
    IInkAnalyzer *pInkAnalyzer)
{
    // Check that the ink analyzer is not currently analyzing ink.
    VARIANT_BOOL bIsAnalyzing;
    HRESULT hr = pInkAnalyzer->IsAnalyzing(&bIsAnalyzing);

    if (SUCCEEDED(hr))
    {
        if (bIsAnalyzing)
        {
            return E_PENDING;
        }

        // Get the ink analyzer's best-result string.
        BSTR recognizedString = NULL;
        hr = pInkAnalyzer->GetRecognizedString(&recognizedString);

        if (SUCCEEDED(hr))
        {
            // Insert code that records the ink analyzer's best-result string here.

            // Get the ink analyzer's root node.
            IContextNode *pRootNode = NULL;
            hr = pInkAnalyzer->GetRootNode(&pRootNode);

            if (SUCCEEDED(hr))
            {
                // Call a helper method that recursively explores context
                // nodes and their subnodes.
                hr = this->ExploreContextNode(pRootNode);
            }

            // Release this reference to the root node.
            if (pRootNode != NULL)
            {
                pRootNode->Release();
                pRootNode = NULL;
            }
        }

        // Free the system resources for the recognized string.
        SysFreeString(recognizedString);
    }

    return hr;
}

Requirements

Requirement Value
Minimum supported client
Windows XP Tablet PC Edition [desktop apps only]
Minimum supported server
None supported
Header
IACom.h (also requires IACom_i.c)
DLL
IACom.dll

See also

IInkAnalyzer

Ink Analysis Reference