![]() |
||||
|
When two add-ins set event handlers to the same command of the Visual Studio .NET IDE, only the last one loaded receives events from that command. Cause This is a bug of Visual Studio .NET. More Information Steps to reproduce the problem:
Private m_objAddIn As AddIn
Private WithEvents m_objAboutCommandEvents As EnvDTE.CommandEvents
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As Extensibility.ext_ConnectMode, _
ByVal addInInst As Object, ByRef custom As System.Array) _
Implements Extensibility.IDTExtensibility2.OnConnection
Dim objDTE As EnvDTE.DTE
Dim objCommand As Command
objDTE = CType(application, EnvDTE.DTE)
m_objAddIn = CType(addInInst, EnvDTE.AddIn)
objCommand = objDTE.Commands.Item("Help.About")
m_objAboutCommandEvents = objDTE.Events.CommandEvents(objCommand.Guid, objCommand.ID)
MessageBox.Show("Addin " & m_objAddIn.Name & " connected")
End Sub
Private Sub m_objAboutCommandEvents_BeforeExecute(ByVal Guid As String, ByVal ID As Integer, _
ByVal CustomIn As Object, ByVal CustomOut As Object, ByRef CancelDefault As Boolean) _
Handles m_objAboutCommandEvents.BeforeExecute
MessageBox.Show("Before showing about window from addin " & m_objAddIn.Name)
End Sub
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this
You can code, design, locate code and document your apps much faster using VB.NET, C#, C++ or Visual J#:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||