Compartir a través de


ISpSREngine::SetTextSelection (Windows CE 5.0)

Send Feedback

This method sets a text selection, as part of the text buffer feature of SAPI. The text buffer feature is optional for engines, and support for it is shown using the "TextBuffer" attribute. If this method is called on an engine that does not support the text buffer feature, the method returns E_NOTIMPL. See also ISpSREngine::SetWordSequenceData.

Once a text buffer has been supplied to the engine, this method can be used to control the parts of the buffer that are active for recognition using a text buffer transition in a CFG. Also the method can be used to tell the engine what the current text insertion point is for dictation.

HRESULT SetTextSelection(  void* pvEngineGrammar,  const SPTEXTSELECTIONINFO* pInfo);

Parameters

  • pvEngineGrammar
    [in] Pointer to the grammar for the engine, as retrieved from a prior to the ISpSREngine::OnCreateGrammar method.
  • pInfo
    [in] Pointer to an SPTEXTSELECTIONINFO structure containing text selection information. See Remarks section.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_NOTIMPL Engine does not support text buffer functionality
FAILED(hr) Other appropriate error message.

Remarks

The first two members of the SPTEXTSELECTIONINFO structure, ulStartActiveOffset and cchActiveChars, show which area of the buffer should be active for recognition when using a text buffer transition in a CFG.

The other two fields of SPTEXTSELECTIONINFO can be used with dictation. These can indicate, for example, which area of the buffer is currently selected on the screen. If the cchSelection member is set to zero, the structure can show where the insertion point currently is. The engine can use this information to get extra language model context from preceding words in the dictated text.

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapiddk.h, Sapiddk.idl.
Link Library: Sapilib.lib.

See Also

ISpSREngine | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.