InkRecognizerContext class

Enables the ability to perform ink recognition, retrieve the recognition result, and retrieve alternates. The InkRecognizerContext enables the various recognizer that are installed on a system to use ink recognition to process input appropriately.

InkRecognizerContext has these types of members:

Events

The InkRecognizerContext class has these events.

Event Description
Recognition Occurs when the InkRecognizerContext has generated results from the BackgroundRecognize method.
RecognitionWithAlternates Occurs when the InkRecognizerContext has generated results after calling the BackgroundRecognizeWithAlternates method

Interfaces

The InkRecognizerContext class defines these interfaces.

Interface Description
IInkRecognizerContext This object implements the IInkRecognizerContext COM interface.

Methods

The InkRecognizerContext class has these methods.

Method Description
BackgroundRecognize Specifies that the recognizer should recognize the associated strokes and fire a Recognition event when recognition is complete.
BackgroundRecognizeWithAlternates Specifies that the recognizer should recognize the associated strokes and fire a RecognitionWithAlternates event when recognition is complete.
Clone Creates a duplicate InkRecognizerContext.
EndInkInput Ends ink input to the InkRecognizerContext.
IsStringSupported Indicates whether the system dictionary, user dictionary, or word list contain a specified string.
Recognize Performs recognition on an InkStrokes collection and returns recognition results.
StopBackgroundRecognition Ends background recognition that was started with a call to BackgroundRecognize or BackgroundRecognizeWithAlternates.

Properties

The InkRecognizerContext class has these properties.

Property Access type Description
CharacterAutoCompletion
Read/write
Gets or sets the character Autocomplete mode, which determines when characters or words are recognized.
Factoid
Read/write
Gets or sets the string name of the factoid used by the InkRecognizerContext object.
Guide
Read/write
Gets or sets the InkRecognizerGuide to use for ink input.
PrefixText
Read/write
Gets or sets the characters that come before the InkStrokes collection in the InkRecognizerContext object.
RecognitionFlags
Read/write
Gets or sets the flags that specify how the recognizer interprets the ink and determines the result string.
Recognizer
Read/write
Gets or sets the IInkRecognizer object used by the InkRecognizerContext object.
Strokes
Read/write
Gets or sets the InkStrokes collection associated with the InkRecognizerContext object.
SuffixText
Read/write
Gets or sets the characters that come after the InkStrokes collection in the InkRecognizerContext object.
WordList
Read/write
Gets or sets the InkWordList object that is used to improve the recognition results.

Remarks

This object can be instantiated by calling the CoCreateInstance method in C++.

There are two types of recognition: background (asynchronous) or foreground (synchronous). Background recognition is started by a call to the BackgroundRecognize or BackgroundRecognizeWithAlternates methods, occurs on a background thread, and reports results to the application through an event mechanism. Foreground recognition does not return until all recognition is completed, thus making recognition results available to the calling thread without listening for the recognition event.

Ink is processed continuously in the background. If an IInkStrokeDisp is added to the InkStrokes collection to which the InkRecognizerContext refers, then the IInkStrokeDisp is then recognized immediately. See remarks in the EndInkInput method topic for more details.

All recognition occurs through a recognizer context. The context defines the settings for a single recognition session. It receives the ink that must be recognized and defines the constraints on the ink input and on the recognition output. The constraints that can be set on the context include the language, the dictionary, and grammar that is being used.

Note

Setting properties other than the Strokes or CharacterAutoCompletion properties succeeds only if the InkStrokes collection is NULL. You must set the other properties before you attach the InkStrokes collection to the InkRecognizerContext, or you must set the InkStrokes collection to NULL and then set the other properties. If you set the InkStrokes collection to NULL and then set the other properties, you may have to reattach the InkStrokes collection. This is because the recognition starts right after you assign the InkStrokes to the InkRecognizerContext. When a call is made to Recognize Method [InkRecognizeContext Class] or BackgroundRecognize, call results might be available already.

To improve your application's performance, dispose of your InkRecognizerContext object when it is no longer needed.

Requirements

Requirement Value
Minimum supported client
Windows XP Tablet PC Edition [desktop apps only]
Minimum supported server
None supported
Header
Msinkaut.h (also requires Msinkaut_i.c)
Library
InkObj.dll

See also

IInkRecognizer Interface

InkStrokes Collection