IVsContainedLanguageStaticEventBinding::EnsureStaticEventHandler Method (String^, String^, String^, String^, String^, UInt32, String^, String^, array<TextSpan>^)

 

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.

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

int EnsureStaticEventHandler(
	String^ pszClassName,
	String^ pszObjectTypeName,
	String^ pszObjectName,
	String^ pszNameOfEvent,
	String^ pszEventHandlerName,
	unsigned int itemidInsertionPoint,
	[OutAttribute] String^% pbstrUniqueMemberID,
	[OutAttribute] String^% pbstrEventBody,
	array<TextSpan>^ pSpanInsertionPoint
)

Parameters

pszClassName
Type: System::String^

[in] The fully qualified name of the class.

pszObjectTypeName
Type: System::String^

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

pszObjectName
Type: System::String^

[in] The name of the object.

pszNameOfEvent
Type: System::String^

[in] The name of the event.

pszEventHandlerName
Type: System::String^

[in] The name of the event handler.

itemidInsertionPoint
Type: System::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
Type: System::String^

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

pbstrEventBody
Type: System::String^

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

pSpanInsertionPoint
Type: array<Microsoft.VisualStudio.TextManager.Interop::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.

Return Value

Type: System::Int32

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

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.

Return to top
Show: