次の方法で共有


IProfferService.ProfferService Method

Allows the caller to proffer a new service to the set of services presently proffered by the environment, either natively or by other installed VSPackages.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'宣言
Function ProfferService ( _
    ByRef rguidService As Guid, _
    psp As IServiceProvider, _
    <OutAttribute> ByRef pdwCookie As UInteger _
) As Integer
'使用
Dim instance As IProfferService
Dim rguidService As Guid
Dim psp As IServiceProvider
Dim pdwCookie As UInteger
Dim returnValue As Integer

returnValue = instance.ProfferService(rguidService, _
    psp, pdwCookie)
int ProfferService(
    ref Guid rguidService,
    IServiceProvider psp,
    out uint pdwCookie
)
int ProfferService(
    [InAttribute] Guid% rguidService, 
    [InAttribute] IServiceProvider^ psp, 
    [OutAttribute] unsigned int% pdwCookie
)
function ProfferService(
    rguidService : Guid, 
    psp : IServiceProvider, 
    pdwCookie : uint
) : int

Parameters

  • rguidService
    Type: System.Guid%

    [in] A GUID that identifies the service being proffered.

  • pdwCookie
    Type: System.UInt32%

    [out, retval] Cookie that identifies the service so that the caller can later revoke the service.

Return Value

Type: System.Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From proffserv.idl:

HRESULT IProfferService::ProfferService(
   [in] REFGUID rguidService,
   [in] IServiceProvider* psp,
   [out] DWORD* pdwCookie
);

Normally used in conjunction with a call to SetSite.

A VSPackage cannot replace the implementation of a service that is already provided by the environment or another loaded VSPackage. Therefore, if a service is already provided at the time an attempt to proffer the same service is made, the IProfferService::ProfferService method will fail and return S_FALSE.

VSPackages proffer their services, and, during normal conditions, they do not revoke their services. These services are revoked as part of the shutdown sequence of the environment.

Permissions

See Also

Reference

IProfferService Interface

IProfferService Members

Microsoft.VisualStudio.Shell.Interop Namespace