Partilhar via


Método IVsContainedLanguageCodeSupport.EnsureEventHandler

Cria um manipulador de eventos recebe o contexto de classe, o nome da instância do objeto, o nome do evento e o nome (exclusivo) do manipulador de eventos, se nenhum já existir.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (em Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Sintaxe

'Declaração
Function EnsureEventHandler ( _
    pszClassName As String, _
    pszObjectTypeName As String, _
    pszNameOfEvent As String, _
    pszEventHandlerName As String, _
    itemidInsertionPoint As UInteger, _
    <OutAttribute> ByRef pbstrUniqueMemberID As String, _
    <OutAttribute> ByRef pbstrEventBody As String, _
    <OutAttribute> pSpanInsertionPoint As TextSpan() _
) As Integer
int EnsureEventHandler(
    string pszClassName,
    string pszObjectTypeName,
    string pszNameOfEvent,
    string pszEventHandlerName,
    uint itemidInsertionPoint,
    out string pbstrUniqueMemberID,
    out string pbstrEventBody,
    TextSpan[] pSpanInsertionPoint
)
int EnsureEventHandler(
    [InAttribute] String^ pszClassName, 
    [InAttribute] String^ pszObjectTypeName, 
    [InAttribute] String^ pszNameOfEvent, 
    [InAttribute] String^ pszEventHandlerName, 
    [InAttribute] unsigned int itemidInsertionPoint, 
    [OutAttribute] String^% pbstrUniqueMemberID, 
    [OutAttribute] String^% pbstrEventBody, 
    [OutAttribute] array<TextSpan>^ pSpanInsertionPoint
)
abstract EnsureEventHandler : 
        pszClassName:string * 
        pszObjectTypeName:string * 
        pszNameOfEvent:string * 
        pszEventHandlerName:string * 
        itemidInsertionPoint:uint32 * 
        pbstrUniqueMemberID:string byref * 
        pbstrEventBody:string byref * 
        pSpanInsertionPoint:TextSpan[] byref -> int
function EnsureEventHandler(
    pszClassName : String, 
    pszObjectTypeName : String, 
    pszNameOfEvent : String, 
    pszEventHandlerName : String, 
    itemidInsertionPoint : uint, 
    pbstrUniqueMemberID : String, 
    pbstrEventBody : String, 
    pSpanInsertionPoint : TextSpan[]
) : int

Parâmetros

  • pszClassName
    Tipo: String

    [in] Nome da classe.

  • pszObjectTypeName
    Tipo: String

    [in] Nome do objeto.

  • pszNameOfEvent
    Tipo: String

    [in] Nome do evento.

  • pszEventHandlerName
    Tipo: String

    [in] Nome do manipulador de eventos.

  • itemidInsertionPoint
    Tipo: UInt32

    [in] O arquivo ou o buffer onde deseja o designer para colocar um novo método. Este é um identificador exclusivo ou pode ser um dos seguintes valores: VSITEMID_NIL, VSITEMID_ROOT ou VSITEMID_SELECTION.

  • pbstrUniqueMemberID
    Tipo: String%

    [out] Retorna uma ID de membro exclusivo para o manipulador de eventos.

  • pbstrEventBody
    Tipo: String%

    [out] Retorna o corpo do manipulador de evento retornado.

Valor de retorno

Tipo: Int32
Se bem-sucedida, retorna S_OK; Caso contrário, retorna um código de erro.

Comentários

COM assinatura

De singlefileeditor.idl:

HRESULT EnsureEventHandler(
   [in]  LPCWSTR   pszClassName,
   [in]  LPCWSTR   pszObjectTypeName,
   [in]  LPCWSTR   pszNameOfEvent,
   [in]  LPCWSTR   pszEventHandlerName,
   [in]  VSITEMID  itemidInsertionPoint,
   [out] BSTR*     pbstrUniqueMemberID,
   [out] BSTR*     pbstrEventBody,
   [out] TextSpan* pSpanInsertionPoint
);

Esse método retorna o corpo de manipulador de eventos inteira e uma representação de seqüência de caracteres que identifica com exclusividade o membro de evento dentro do contexto de determinada classe. No caso em que o manipulador de eventos já existe, a identificação de membro exclusivo desse membro de classe é retornada com uma seqüência nula para os dois o evento ID corpo e membro.

O itemidInsertionPoint parâmetro indica o arquivo/buffer onde deseja o designer para colocar um novo método. Se o método não existe, então o ponto de inserção é retornado na pSpanInsertionPoint parâmetro é para o buffer dos solicitados itemid.

Observe que esse método não injetar o manipulador de eventos gerados buffer secundário ou arquivo de classe parcial, somente no buffer principal.

Segurança do .NET Framework

Consulte também

Referência

IVsContainedLanguageCodeSupport Interface

Namespace Microsoft.VisualStudio.TextManager.Interop