Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
TSF Reference
TSF Interfaces
ITfInputScope
ITfInputScope Interface

The ITfInputScope interface is used by the text input processors to get the InputScope value that represents a document context associated with a window. The input scope provides rules to help speech and handwriting recognition. For instance, if a text box on a form is used to enter an address, the input scope for that text box can be set to recognize and accept only those characters that are valid for an address.

The interface ID is IID_ITfInputScope.

The document context is used by the speech and handwriting recognition engine and is set by a text input processor by calling the SetInputScope method. A TSF-aware application does not call SetInputScope directly, but rather implements either ITextStoreACP or ITfContextOwner to get a pointer to ITfInputScope.

To get the pointer to the ITfInputScope interface, the text input processor or TSF-aware application calls ITfContext::GetAppProperty, passing in GUID_PROP_INPUTSCOPE and a pointer to the ITFReadOnlyProperty interface, as in the following example.


extern const GUID GUID_PROP_INPUTSCOPE;
// 
// The TIP can call this to get the input scope of the document mgr. 
// 
HRESULT GetInputScope(ITfContext *pic, ITfRange *pRange, TfEditCookie ec, ITfInutScope **ppiscope){
    ITFReadOnlyProperty *prop;
    HRESULT hr;
    If (SUCCEEDED(hr = pic->GetAppProperty(GUID_PROP_INPUTSCOPE, &prop))
    {   VARIANT var;
        If (SUCCEEDED(hr = prop->GetValue(ec, pRange, &var)))
        {  hr = var.punkVal->QueryInterface(IID_ITfInputScope, (void **)ppiscope);
        }
        prop->Release();
    }
    return hr
}

Methods

The ITfInputScope interface inherits the methods of the IUnknown interface.

In addition, ITfInputScope defines the following methods.

MethodDescription

GetInputScopes

Gets the input scopes that are associated with this context.

GetPhrase

Gets the phrase list set to this context.

GetRegularExpressions

Gets the regular expression string to be recognized.

GetSRGS

Gets the Speech Recognition Grammar Specification (SRGS) string to be recognized.

GetXML

Gets the custom XML string to be recognized.

 

Remarks

To use this interface with window-less controls, an application has two options.

  1. Make the application TSF-aware: A TSF-aware application must implement either ITextStoreACP or ITfContextOwner to get a pointer to ITfInputScope.
  2. SetInputScopes This is not recommended, but if the application is not TSF-aware, there is no other way to maintain the association between the input scope and the application. In this case, the application must call SetInputScopes whenever focus changes among window-less controls.

Requirements

Minimum supported clientWindows XP
Minimum supported serverWindows Server 2003
HeaderInputScope.idl and InputScope.h
DLLMsctf.dll

Send comments about this topic to Microsoft

Build date: 7/14/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker