EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

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
}


Members

The ITfInputScope interface inherits from the IUnknown interface. ITfInputScope also has these types of members:

Methods

The ITfInputScope interface has these methods.

MethodDescription
GetInputScopes

Gets the input scopes that are associated with this context.

GetPhrase

Gets the phrase list set to this context.

GetRegularExpression

Gets the regular expression string to be rssecognized.

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 client

Windows XP [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2003 [desktop apps | Windows Store apps]

Header

InputScope.h

IDL

InputScope.idl

DLL

Msctf.dll

 

 

Ajouts de la communauté

AJOUTER
Afficher:
© 2014 Microsoft