다음을 통해 공유


ISpSREngine::SetTextSelection (Windows Embedded CE 6.0)

1/6/2010

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.

Syntax

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

Parameters

  • pInfo
    [in] Pointer to an SPTEXTSELECTIONINFO structure containing text selection information. See Remarks section.

Return Value

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

Header sapiddk.h, sapiddk.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpSREngine
SAPI Interfaces