IServiceProvider::QueryService

Creates or accesses the specified service and returns an interface pointer to the specified interface for the service.

HRESULT QueryService(
  REFGUID guidService,
                //Unique identifier for the requested service
  REFIID riid,  //Unique identifier for the requested interface
  void** ppv    //Address of output variable that receives the 
                //interface pointer requested in riid
);
 

Parameter

guidService
[in] Unique identifier for the requestedservice.
riid
[in] Unique identifier for the requested interface on the service.
ppv
[out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppv contains the requested interface pointer to the service.

Return Values

S_OK
The service was successfully created or retrieved.
E_OUTOFMEMORY
There is not enough memory to create the service.
E_UNEXPECTED
An unknown error occurred.
E_NOINTERFACE
The service exists but the requested interface is not provided by the service.
SVC_E_UNKNOWNSERVICE
The service identified with guidService is not recognized.
Note to Callers

The caller is responsible for releasing the interface pointer when it is no longer needed.

Note to Implementers

Because there is only one method in this interface, E_NOTIMPL is not a valid return code.

QuickInfo

  Windows NT: Use version 4.0 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in ocidl.h.