Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I got a problem in my Inventor 2014 addin with applicationsEvents.
The code below fires not before but 2 times after event, what is wrong?
'In Class StandardAddInServer Private WithEvents m_ApplicationEvents As Inventor.ApplicationEvents 'in Public Sub Activate m_ApplicationEvents = m_inventorApplication.ApplicationEvents AddHandler m_ApplicationEvents.OnSaveDocument, AddressOf m_ApplicationEvents_OnSaveDocument m_ApplicationEvents = m_inventorApplication.ApplicationEvents AddHandler m_ApplicationEvents.OnOpenDocument, AddressOf Me.m_ApplicationEvents_OnOpenDocument ' And then Private Sub m_ApplicationEvents_OnOpenDocument(ByVal DocumentObject As Inventor._Document, ByVal FullDocumentName As String, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Dim kBefore As EventTimingEnum = Nothing If BeforeOrAfter = kBefore Then MessageBox.Show("open - Before") Else MessageBox.Show("Open - After") End If End Sub Private Sub m_ApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_ApplicationEvents.OnSaveDocument Dim kBefore As EventTimingEnum = Nothing If BeforeOrAfter = kBefore Then MessageBox.Show("Save as - Before") Else MessageBox.Show("Save as - After") End If End Sub
Solved! Go to Solution.