Share via


ResultByType Method

ResultByType Method

Gets the requested structural units of the analysis results for an IInkDivisionUnits collection.

Declaration

[C++]

HRESULT ResultByType(
    [in] InkDivisionType divisionType,
    [out,retval] IInkDivisionUnits** InkDivisionUnits
);

[Microsoft® Visual Basic® 6.0]

Public Function RsultByType( _
    divisionType As InkDivisionType _
) As InkDivisionUnits

Parameters

divisionType

[in] The InkDivisionType enumeration value that indicates the structural units to return.

InkDivisionUnits

[out] Returns the IInkDivisionUnits collection containing the requested structural units of the analysis results.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contains an invalid pointer.
E_INVALIDARG A parameter contains an invalid value.
E_UNEXPECTED Unexpected parameter or property type.
E_INK_EXCEPTION An exception occurred inside the method.

Remarks

This method returns a new IInkDivisionUnits collection each time the method is called.

If no structural units of the requested type exist in the IInkDivisionResult object, then this method returns an empty IInkDivisionUnits collection.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates an InkDivider, theDivider, and assigns to it an InkStrokes collection, theStrokes, and a InkRecognizerContext object, theRecognizerContext. The Divide method is called to get a snapshot of the analysis results theResult. The ResultByType method is called with an InkDivisionType enumeration value of IDT_Line to retrieve all of the line units within theResult. If the collection of lines is not empty, then for each line theLine in the collection, the DivisionType, Strokes, RecognitionString, and RotationTransform properties are retrieved.

' Create the InkDivider and assign a strokes collection to it.
Dim theDivider As InkDivider
Set theDivider = New InkDivider
Set theDivider.RecognizerContext = theRecognizerContext
Set theDivider.Strokes = theStrokes

' Retrieve the analysis results, and get the first line.
Dim theResult As IInkDivisionResult
Set theResult = theDivider.Divide()
Dim theDivisionUnits As IInkDivisionUnits
Set theDivisionUnits = theResult.ResultByType(InkDivisionType.IDT_Line)
Dim theLine As IInkDivisionUnit
If Not (theDivisionUnits Is Nothing) Then
    For Each theLine In theDivisionUnits
        ' For each line element in the collection
        ' retrieve the division type, the strokes,
        ' the recognition string, and the rotation transform.
        Dim theDivisionType As InkDivisionType
        theDivisionType = theLine.DivisionType
        Dim elementStrokes As InkStrokes
        Set elementStrokes = theLine.Strokes
        Dim theRecognitionString As String
        theRecognitionString = theLine.RecognizedString
        Dim theInkTransform As InkTransform
        theInkTransform = theLine.RotationTransform
    Next
End If

Applies To