Share via


RecognitionFlags Property

RecognitionFlags Property

Gets or sets the flags that specify how the recognizer interprets the ink and determines the result string.

Declaration

[C++]

[C++]

[propput] HRESULT put_RecognitionFlags (
    [in] InkRecognitionModes RecognitionFlags
);
[propget] HRESULT get_RecognitionFlags (
    [out, retval] InkRecognitionModes* RecognitionFlags
);

      

[Microsoft® Visual Basic® 6.0]

[Visual Basic]

Public Property Get RecognitionFlags() As InkRecognitionModes
Public Property Let RecognitionFlags( _
    ByVal theRecognitionFlags As InkRecognitionModes)

      

Property Value

InkRecognitionModes The flags that specify how the recognizer interprets the ink and determines the result string.

This property is read/write.

Return Value

HRESULT value Description
S_OK Success.
E_INVALIDARG The flag is invalid.
E_NOTIMPL The recognizer does not support this property.
E_OUTOFMEMORY Cannot allocate memory to complete the operation.
E_FAIL An unspecified error occurred.
E_INK_EXCEPTION An exception occurred inside the method.
E_POINTER The parameter is an invalid out pointer.
E_INVALIDARG Invalid mode.
E_UNEXPECTED Unexpected parameter or property type.
TPC_E_OUT_OF_ORDER_CALL This property cannot be assigned after strokes have been added to the Strokes property.

Remarks

The RecognitionFlags property gets or sets flags that specify things such as whether the recognizer treats all ink as a single word or whether the recognizer coerces the result based on the factoid that you specified for the context.

Setting the RecognitionFlags property succeeds only if the Strokes property is NULL (Nothing in Visual Basic 6.0). You must set the SuffixText property before you attach a InkStrokes collection to the Strokes property of the InkRecognizerContext, or you must set the Strokes property to NULL and then set the SuffixText property.

Note: If you use the latter method, you may need to reattach the InkStrokes collection to the Strokes property of the InkRecognizerContext object.

For a list of modes that you can use, see the InkRecognitionModes enumeration type.

Note: You can combine modes using the bitwise OR operator.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows a button click event handler, Command1_Click, that recognizes the ink in its InkRecognizerContext, theRecognizerContext, setting the RecognitionFlags to recognize whole words, and displays the results in a text box, theTextBox, if no errors occurred.

[Visual Basic]

Option Explicit
Dim theInkCollector As InkCollector
Dim theRecognizerContext As New InkRecognizerContext

Private Sub Form_Load()
    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.Enabled = True
End Sub

Private Sub Command1_Click()
    theRecognizerContext.RecognitionFlags = IRM_WordModeOnly
    Set theRecognizerContext.Strokes = theInkCollector.Ink.Strokes
    theRecognizerContext.EndInkInput
    Dim theRecognitionStatus As InkRecognitionStatus
    Dim theRecognitionResult As IInkRecognitionResult
    On Error Resume Next
    Set theRecognitionResult = theRecognizerContext.Recognize(theRecognitionStatus)
    If InkRecognitionStatus.IRS_NoError = theRecognitionStatus Then
        theTextBox.Text = theRecognitionResult.TopString
    Else
        'Handle the error conditions here.
        theTextBox.Text = ""
    End If
End Sub

      

Applies To