Provides a generic access mechanism to locate a GUID-identified service.
QueryService Acts as the factory method for any services exposed through an implementation of IServiceProvider.
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 only one member, 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 IID for this interface is
Stock Implementation None Custom Implementation Yes Inherits from IUnknown Header and IDL files Servprov.h, Servprov.idl Minimum availability Internet Explorer 4.0 Minimum operating systems Windows 95, Windows NT 4.0