Freigeben über


SetFlags Function

SetFlags Function

Specifies how the recognizer interprets the ink and determines the result string.

You call this function before processing the ink for the first time. Therefore, call the SetFlags function before calling the Process function.

Syntax

[C++]

HRESULT WINAPI SetFlags(
  HRECOCONTEXT hrc,
  DWORD dwFlags
);

Parameters

hrc [in] Handle to the recognizer context.
dwFlags [in] The following table lists the flags that you may set to specify how the recognizer interprets the ink and determines the result string. Use the OR operator (|) to combine flags as appropriate.
Bit flag Description
RECOFLAG_AUTOSPACE Recognizer uses smart spacing based on language model rules.
RECOFLAG_COERCE Recognizer coerces the result based on the factoid you specify for the context. For example, if you specify a phone number factoid and the user enters the word "hello", the recognizer may return a random phone number or an empty string. If you do not specify this flag, the recognizer returns "hello" as the result.
RECOFLAG_PREFIXOK Recognizer supports the recognition of any prefix part of the strings that are defined in the default or specified (factoid) language model.

For example, without this flag, the user writes "handw" and the recognizer returns suggestions (such as "hander" or "handed") that are words that exist in the recognizer lexicon. With the flag, the recognizer may return "handw" as one of the suggestions since it is a valid prefix of the word "handwriting" that exists in the recognizer lexicon.

The Tablet PC Input Panel sets this flag in most cases, except when the input scope is IS_DEFAULT (or no input scope) or when there is not user word list or regular expression.

Recognizers of East Asian languages should return E_INVALIDARG when a caller passes in this flag.

RECOFLAG_LINEMODE The recognizer does not split lines but must still do character and word separation. This is the same as lined mode, except that there is no guide, and all ink is assumed to be in a single line. When this flag is set, a guide, if set, is ignored.
RECOFLAG_SINGLESEG Disables multiple segmentation. By default, the recognizer returns multiple segmentations (alternates) for the ink.

For example, if you write "together" as separate strokes, the recognizer may segment the ink as "to get her", "to gather", or "together". Set this flag if you do not need multiple segmentations of the ink when you query for alternates. This improves performance and reduces memory usage.

RECOFLAG_WORDMODE Recognizer treats the ink as a single word. For example, if the context contains "to get her", the recognizer returns "together".

Return Values

HRESULT value Description
S_OK Success.
E_INVALIDARG The flag is invalid.
E_NOTIMPL The recognizer does not support this function.
E_OUTOFMEMORY Unable to allocate memory to complete the operation.
E_FAIL An unspecified error occurred.
E_POINTER The context is invalid or one of the parameters is an invalid pointer.

Remarks

Prior to Microsoft® Windows® XP Tablet PC Edition Development Kit 1.7, Tablet PC Input Panel performed smart spacing. Starting with Tablet PC SDK 1.7, Tablet PC Input Panel continues to produce results with preliminary spacing recommendations. Tablet PC Input Panel's spacing results may however be changed by the recognizer's recommendations (results). The recognizer is able to do this by using text contextual information (based on the SetTextContext call made by Tablet PC Input Panel) and its internal language model rules.

Tablet PC Input Panel is able to determine whether or not the recognizer is capable of doing auto-spacing by calling this function with the RECOFLAG_AUTOSPACE flag set. If the recognizer does not support auto-spacing, E_NOTIMPL is returned.

Note: The single-line flag is not compatible with the guide flag. Callers must select only one of boxed mode, line mode, free mode, or single-line mode.