IServiceProvider interface (servprov.h)

Provides a generic access mechanism to locate a GUID-identified service.

Inheritance

The IServiceProvider interface inherits from the IUnknown interface.

Methods

The IServiceProvider interface has these methods.

 
IServiceProvider::QueryService

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

Acts as the factory method for any services exposed through an implementation of IServiceProvider. Accepts a CLSID parameter.

Remarks

The IServiceProvider interface is a generic access mechanism to locate a GUID-identified service that is provided through a control or any other object that the service can communicate with. For example, an embedded object (such as an OLE control) typically communicates only with its associated client site object in the container through the IOleClientSite interface that is supplied by using IOleObject::SetClientSite. The embedded object must ask the client site for some other service that the container supports when that service might not be implemented in the client site.

The client site must provide a means by which the control that is managed by the site can access the service when necessary. For example, the IOleInPlaceSite::GetWindowContext) function can be used by an in-place object or control to access interface pointers for the document object that contains the site and the frame object that contains the document. Because these interface pointers exist on separate objects, the control cannot call the site's QueryInterface to obtain those pointers. Instead, use the IServiceProvider interface.

The IServiceProvider interface has to overloads of a single method, QueryService, through which a caller specifies the service ID (SID, a GUID), the IID of the interface to return, and the address of the caller's interface pointer variable. The second overload infers the IID from the output pointer passed into the method.

The IID for this interface is IID_IServiceProvider.

Requirements

Requirement Value
Minimum supported client Windows Build 22000
Minimum supported server Windows Build 22000
Header servprov.h