Export (0) Print
Expand All

ISpRecoContext::GetRecognizer (SAPI 5.3)

Speech API 5.3
Microsoft Speech API 5.3

ISpRecoContext::GetRecognizer

ISpRecoContext::GetRecognizer returns a reference to the current recognizer object associated with this context.


HRESULT GetRecognizer(
   ISpRecognizer   **ppRecognizer
);

Parameters

ppRecognizer
[out] Address of a pointer that receives the ISpRecognizer interface. The application must call IUnknown::Release when finished with the interface.

Return values

ValueDescription
S_OKFunction completed successfully.
E_POINTERInvalid pointer.
FAILED (hr)Appropriate error message.

Example

The following code snippet illustrates the use of ISpRecoContext::GetRecognizer with a shared context


// Declare local identifiers:
HRESULT                    hr = S_OK;
CComPtr<ISpRecoContext>    cpRecoContext;
CComPtr<ISpRecognizer>     cpRecognizer;

// Create a shared recognition context.
hr = cpRecoContext.CoCreateInstance(CLSID_SpSharedRecoContext);

if (SUCCEEDED(hr))
{
   // Get a reference to the associated recognizer.
   hr = cpRecoContext->GetRecognizer(&cpRecognizer;);
}

if (SUCCEEDED(hr))
{
   // Assert that our shared context has a shared recognizer.
   hr = cpRecognizer->IsSharedInstance();
}

if (SUCCEEDED(hr))
{
   // Do something here.
}
Show:
© 2014 Microsoft