ISpRecoGrammar::LoadCmdFromProprietaryGrammar (Windows Embedded CE 6.0)

1/6/2010

This method loads a proprietary grammar. Applications should use LoadCmdFromProprietaryGrammar when using a proprietary grammar format that the SR engine supports (see ISpSREngine::LoadProprietaryGrammar). If the current SR engine does not support the proprietary grammar format (specified using rguidParam and pszStringParam), then the SR engine can return E_NOTIMPL.

Syntax

HRESULT LoadCmdFromProprietaryGrammar(
  REFGUID rguidParam,
  const WCHAR* pszStringParam,
  const void* pvDataParam,
  ULONG cbDataSize,
  SPLOADOPTIONS Options
);

Parameters

  • rguidParam
    [in] Unique identifier of the grammar (type GUID). The GUID will be used by the application and the SR engine to uniquely identify the SR engine for verifying support.
  • pszStringParam
    [in] Pointer to the string command. The string can be used by the application and the SR engine to specify which part of a grammar to utitlize.
  • pvDataParam
    [in] Pointer to additional information for the process. SAPI will handle the marshalling of the data to the SR engine.
  • cbDataSize
    [in] Size, in bytes, of information specified by pvDataParam.
  • Options
    [in] Value indicating if the file should be loaded dynamically. Possible values are defined for the SPLOADOPTIONS enumeration. This value must be SPLO_STATIC.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_INVALIDARG

pszStringParam or pvDataParam is invalid or bad. Alternatively, Options is not SPLO_STATIC.

FAILED(hr)

Appropriate error message.

Remarks

When an application calls this method, the currently loaded CFG or proprietary will be unloaded.

Example

HRESULT hr = S_OK;
// create a new grammar object
hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar);
// Check hr
// load our proprietary grammar
hr = cpRecoGrammar->LoadCmdFromProprietaryGrammar(
                             GUID_MyProprietaryGrammarType, 
                             NULL, 
                             bGrammarData, 
                             ulSizeOfGrammarData, 
                             SPLO_STATIC);
// Check hr

Requirements

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

See Also

Reference

ISpRecoGrammar
SAPI Interfaces