Click to return to the Component Development home page    
IServiceProvider Interfac...     Component Structures Refe...     IServiceProvider Interfac...    
Web Workshop  |  Component Development

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] Unique identifier of the service (an SID).
riid
[in] Unique identifier of the interface the caller wishes to receive for the service.
ppv
[out] 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 needed.

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.
SVC_E_UNKNOWNSERVICE The service identified with guidService is not recognized.

Remarks

QueryService creates or accesses the implementation the service identified with guidService, returning in ppv the address of the interface specified by riid.

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



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.