Helper SpCreateBestObject

Microsoft Speech SDK

The Microsoft.com Speech website Microsoft Speech SDK SAPI 5.1

SpCreateBestObject

SpCreateBestObject creates an object from tokens that best match a set of criteria from required and optional attributes.

Found in: sphelper.h

SpCreateBestObject(
   const WCHAR   *pszCategoryId,
   const WCHAR   *pszReqAttribs,
   const WCHAR   *pszOptAttribs,
   T            **ppObject,
   IUnknown      *IUnknown = NULL,
   DWORD          dwClsCtxt = CLSCTX_ALL,
);

Parameters

pszCategoryId
[in] The null-terminated string category ID on which to base the new token.
pszReqAttribs
[in] The null-terminated string of required attributes for the token.
pszOptAttribs
[in] The null-terminated string of optional attributes for the token.
ppObject
[out, iid_is(riid)] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, ppObject contains the requested interface pointer. If the object does not support the interface specified in riid, the implementation must set ppObject to NULL.
IUnknown
[in] Optional parameter used for creating aggregate objects. pUnkOuter is the data for the object. If not specified, the value defaults to NULL.
dwClsCtxt
[in] Context in which the code that manages the newly created object will run. It should be one of the following values. If not specified, the value defaults to CLSCTX_ALL.
  • CLSCTX_INPROC_SERVER
  • CLSCTX_INPROC_HANDLER
  • CLSCTX_LOCAL_SERVER
  • CLSCTX_REMOTE_SERVER

Return values

Value Description
S_OK Function completed successfully.
FAILED (hr) Appropriate error message.