Partager via


IInkRecognitionResult::GetAlternatesFromSelection

4/8/2010

Returns the alternate collection from a selection within the best result string of the recognition result so that each alternate corresponds to only one segment of ink.

Syntax

HRESULT AlternatesFromSelection (
    [in, optional, defaultvalue(IRAS_Start)] long selectionStart,
  [in, optional, defaultvalue(IRAS_All)] long selectionLength,
  [in, optional, defaultvalue(IRAS_DefaultCount)] long maximumAlternates,
  [out, retval] IinkRecognitionAlternates **AlternatesFromSelection
);

Parameters

  • selectionStart
    The start of the text selection from which the collection of alternates is returned. The default value is InkRecognitionAlternatesSelection.IRAS_Start.
  • selectionLength
    The length of the text selection from which the collection of alternates is returned. The default value is InkRecognitionAlternatesSelection.IRAS_All, which specifies the text beginning from selectionStart to the end of the string.
  • maximumAlternates
    The maximum number of alternates to return. The default value is InkRecognitionAlternatesSelection.IRAS_DefaultCount. Recognizers that cannot compute the number of alternates, because of degree of difficulty or length of time, return an arbitrary number of alternates.

    Note   The number of alternates increases exponentially for large ranges and for some languages, so applications should specify the number of alternates rather than query for the maximum number of alternates that the recognizer can return.

  • AlternatesFromSelection
    Returns the IInkRecognitionAlternates collection of alternates from a selection within the best result string of the recognition result.

Return Value

HRESULT value Description

S_OK

Success.

E_INVALIDARG

The recognition range is invalid.

E_INK_EXCEPTION

An exception occurred while processing.

E_POINTER

A parameter contained an invalid pointer.

E_OUTOFMEMORY

Cannot allocate memory to complete the operation.

Remarks

The selection "how are you" is probably broken into three segments (depending on the spacing between segments), one for each word. Call IInkRecognitionResult::GetAlternatesFromSelection to return the alternates for only one segment of this selection. Note that the selectionStart and selectionLength indices correspond to the character index, not a segment index. So to get the alternates from the word "are", call GetAlternatesFromSelection with the parameters of selectionStart = 4 and selectionLength = 3, since the word "are" starts at the 4th character (beginning at 0) and is 3 characters long.

Note the difference between this GetAlternatesFromSelection method and the IInkRecognitionAlternate::ConfidenceAlternates methods. Although GetAlternatesFromSelection returns a collection of alternates in which each alternate corresponds to only one segment of ink within a selection, AlternatesWithConstantPropertyValues, LineAlternates, and ConfidenceAlternates return the collection of alternates in which the alternates correspond to each segment of ink within a selection.

Note

This method throws an invalid argument exception if the selectionLength is zero.

Requirements

Header msinkaut.h
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile 6 Classic and later, Windows Mobile 6 Professional and later

See Also

Concepts

Windows Mobile Ink Reference