Udostępnij za pośrednictwem


IServiceProvider interface

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

Members

The IServiceProvider interface inherits from the IUnknown interface. IServiceProvider also has these types of members:

  • Methods

Methods

The IServiceProvider interface has these methods.

Method Description
QueryService

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

 

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 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 IID_IServiceProvider.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Servprov.h

IDL

Servprov.idl