ISpResourceManager::GetObject (SAPI 5.4)
Microsoft Speech API 5.4
ISpResourceManager::GetObject retrieves a service object from the current service list, or creates one if it does not exist.
HRESULT GetObject( REFGUID guidServiceId, REFCLSID ObjectCLSID, REFIID ObjectIID, BOOL fReleaseWhenNoRefs, void **ppObject );
[in] The unique identifier of the service.
[in] Class identifier of the object.
[in] Identifier of interface to return in ppObject
[in] Boolean indicating whether the object should be freed when the last client outside of the resource manager releases the object. If this flag is set, the object specified by ObjectCLSID must support aggregation.
[out] Address of a pointer that receives the interface pointer of the service.
If the object does not exist, the ObjectCLSID parameter will be used to CoCreateInstance the object. This functionality allows multiple threads to ensure that a single shared object is created atomically by the resource manager. If the fReleaseWhenNoRefs flag is set to TRUE, the final release of the object will remove it from the service list. If fReleaseWhenNoRefs is FALSE, the service will remain in the service list until the resource manager is released or the service is explicitly removed through a SetObject call.