Implement a Simple Test AddIn
Add a reference to System.Windows.Forms (in the Solution Explorer right-click References / Add Reference; in the .NET tab choose System.Windows.Forms and click OK) and make the following changes to your code:
Visual Basic .NET
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports Therefore.API
<Guid("34B32BFD-C91D-44e6-B1C2-468635C1059F"), ComVisible(True), ClassInterface(ClassInterfaceType.None)> _
Public Class MyAddInClass
Implements ITheAddIn
Public Sub GetHandledEvents(ByVal nClient As The.API.TheClientType, ByVal pEventSet As The.API.TheEventSet) Implements The.API.ITheAddIn.GetHandledEvents
MessageBox.Show("MyAddInClass successfully registered.")
End Sub
Public Function HandleEvent(ByVal pEvent As The.API.TheEvent) As Integer Implements The.API.ITheAddIn.HandleEvent
Throw New NotImplementedException()
End Function
End Class
pEventSet.AddAll() will tell the Thereforeā¢ AddIn system that we want to receive all occurring events.
In HandleEvent we display a message box with a string representation of the incoming event. We return the default return code (0), thereby telling the AddIn system to continue as usual. Please check the various events for the event-specific meaning of different return codes.
|