次の方法で共有


AddWord Method [InkWordList Class]

AddWord Method [InkWordList Class]

Adds a single word to the InkWordList object.

Declaration

[C++]

HRESULT AddWord(
    [in] BSTR word
);

[Microsoft® Visual Basic® 6.0]

Public Sub AddWord( _
    word As String _
)

Parameters

word

[in] The word to add to a InkWordList object. The word is not added if it already exists in the list.

For more information about the BSTR data type, see Using the Automation Library.

Return Value

HRESULT value Description
S_OK Success.
S_FALSE The word already exists in the list.
E_OUTOFMEMORY Cannot allocate memory to complete the operation.
E_FAIL An unspecified error occurred.
E_POINTER A parameter contained an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.

Remarks

If a string is added to a word list, its capitalized versions are also implicitly added. For instance, adding "hello" implicitly adds "Hello" and "HELLO".

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example adds a word to a InkWordList object, theWordList, assigned to the default InkRecognizerContext object.

Private Sub AddAWord()
    Dim theRecognizers As New InkRecognizers
    Dim theRecognizer As IInkRecognizer
    Set theRecognizer = theRecognizers.GetDefaultRecognizer
    Dim theRecognizerContext As InkRecognizerContext
    Set theRecognizerContext = theRecognizer.CreateRecognizerContext
    Dim theWordList As InkWordList
    Set theWordList = New InkWordList
    theWordList.AddWord ("Microsoft")
    Set theRecognizerContext.wordlist = theWordList
End Sub

Applies To