Export (0) Print
Expand All

IServiceProvider::QueryService Method

Acts as the factory method for any services exposed through an implementation of IServiceProvider.

Syntax


HRESULT QueryService(
    REFGUID guidService,
    REFIID riid,
    void **ppv
);

Parameters

guidService
[in] The unique identifier of the service (an SID).
riid
[in] The unique identifier of the interface that the caller wants to receive for the service.
ppv
[out] The address of the caller-allocated variable to receive the interface pointer of the service on successful return from this function. The caller becomes responsible for calling Release through this interface pointer when the service is no longer required.

Return Value

Returns one of the following values.

S_OK The service was successfully created or retrieved. The caller is responsible for calling ((IUnknown *)*ppv)->Release();.
E_OUTOFMEMORY There is insufficient memory to create the service.
E_UNEXPECTED An unknown error occurred.
E_NOINTERFACE The service exists, but the interface requested does not exist on that service.
E_NOTIMPL The service is not supported.

Remarks

QueryService creates or accesses the implementation of the service identified with guidService. In ppv, it returns the address of the interface that is specified by riid.

Because there is only one member function in this interface, E_NOTIMPL is not a valid return code. If QueryService is not implemented, the interface has no reason to exist.

Community Additions

ADD
Show:
© 2014 Microsoft