다음을 통해 공유


ISpResourceManager::GetObject (Windows CE 5.0)

Send Feedback

This method gets a service object from the current service list. If the object does not exist then the ObjectCLSID parameter will be used to call CoCreateInstance for the object. This 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.

HRESULT GetObject(  REFGUID guidServiceId,  REFCLSID ObjectCLSID,  REFIID ObjectIID,  BOOL fReleaseWhenNoRefs,  void** ppObject);

Parameters

  • guidServiceId
    [in] The unique identifier of the service.
  • ObjectCLSID
    [in] Class identifier of the object.
  • ObjectIID
    [in] Identifier of interface to retrieve in ppObject
  • fReleaseWhenNoRefs
    [in] Value indicating if the object should be freed when the last client outside of the resource manager releases the object. Set this value to TRUE to free the object, and to FALSE otherwise. If this value is TRUE, the object specified by ObjectCLSID must support aggregation.
  • ppObject
    [out] Address of a pointer to the interface for the service object.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_INVALIDARG One or more arguments are invalid.
E_POINTER ppObject is bad or invalid.
REGDB_E_CLASSNOTREG Class is not registered.
E_OUTOFMEMORY Exceeded available memory.
FAILED(hr) Appropriate error message.

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: sapi.h, sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpResourceManager | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.