IVsContainedLanguageStaticEventBinding.EnsureStaticEventHandler Method

Definition

Creates an event handler given the class context, name of the object type and instance, the name of the event and the (unique) name of the event handler.

public:
 int EnsureStaticEventHandler(System::String ^ pszClassName, System::String ^ pszObjectTypeName, System::String ^ pszObjectName, System::String ^ pszNameOfEvent, System::String ^ pszEventHandlerName, System::UInt32 itemidInsertionPoint, [Runtime::InteropServices::Out] System::String ^ % pbstrUniqueMemberID, [Runtime::InteropServices::Out] System::String ^ % pbstrEventBody, cli::array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> ^ pSpanInsertionPoint);
int EnsureStaticEventHandler(std::wstring const & pszClassName, std::wstring const & pszObjectTypeName, std::wstring const & pszObjectName, std::wstring const & pszNameOfEvent, std::wstring const & pszEventHandlerName, unsigned int itemidInsertionPoint, [Runtime::InteropServices::Out] std::wstring const & & pbstrUniqueMemberID, [Runtime::InteropServices::Out] std::wstring const & & pbstrEventBody, std::Array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> const & pSpanInsertionPoint);
public int EnsureStaticEventHandler (string pszClassName, string pszObjectTypeName, string pszObjectName, string pszNameOfEvent, string pszEventHandlerName, uint itemidInsertionPoint, out string pbstrUniqueMemberID, out string pbstrEventBody, Microsoft.VisualStudio.TextManager.Interop.TextSpan[] pSpanInsertionPoint);
abstract member EnsureStaticEventHandler : string * string * string * string * string * uint32 * string * string * Microsoft.VisualStudio.TextManager.Interop.TextSpan[] -> int
Public Function EnsureStaticEventHandler (pszClassName As String, pszObjectTypeName As String, pszObjectName As String, pszNameOfEvent As String, pszEventHandlerName As String, itemidInsertionPoint As UInteger, ByRef pbstrUniqueMemberID As String, ByRef pbstrEventBody As String, pSpanInsertionPoint As TextSpan()) As Integer

Parameters

pszClassName
String

[in] The fully qualified name of the class.

pszObjectTypeName
String

[in] The fully qualified name of the object type.

pszObjectName
String

[in] The name of the object.

pszNameOfEvent
String

[in] The name of the event.

pszEventHandlerName
String

[in] The name of the event handler.

itemidInsertionPoint
UInt32

[in] The file to insert into. This is a unique hierarchy identifier or one of the following values: VSITEMID_NIL, VSITEMID_ROOT or VSITEMID_SELECTION.

pbstrUniqueMemberID
String

[out] Returns a string containing the member ID of the event. Returns a null value if the event handler already exists.

pbstrEventBody
String

[out] Returns a string containing the body of the event handler. Returns a null value if the event handler already exists.

pSpanInsertionPoint
TextSpan[]

[in, out] Fills in a TextSpan object with the position where the event handler body was inserted in the primary buffer. This insertion point is in the file specified by the itemidInsertionPoint parameter. This is valid only if the event handler did not already exist.

Returns

If successful, returns S_OK; otherwise, returns an error code.

Remarks

COM Signature

From singlefileeditor.idl:

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

If the event handler already exists, this method returns S_OK and the pbstrEventBody and pbstrUniqueMemberID parameters return null values and the pSpanInsertionPoint parameter is undefined.

Note that this method does not inject the generated event handler into the secondary buffer or partial class file, only into the primary buffer.

Applies to