Hallo Forum
Ich versuche mich gerade in VB.net und laufe hier in ein Problem
das schon mal besprochen wurde, komme aber nicht klar - - wenns zu trivial ist entschuldige ich mich (aber man muss ja irgendwie anfangen)
Ich arbeite noch mit Inventor 2009 und visual Studio 2005
Ich möchte den ApplicationEvent OnSaveDocument auslösen, also immer wenn ein
Dokument gespeichert wird, soll vorher etwas passieren.
Ich habe das folgendermaßen probiert:
Imports Inventor
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Namespace Si_DoOnSave
<ProgIdAttribute("Si_DoOnSave.StandardAddInServer"), _
GuidAttribute("3b9ad192-50f1-45a4-ada1-4c38841f8031")> _
Public Class StandardAddInServer
Implements Inventor.ApplicationAddInServer
' Inventor application object.
Private m_inventorApplication As Inventor.Application
Private WithEvents m_ApplicationEvents As Inventor.ApplicationEvents
#Region "ApplicationAddInServer Members"
Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
' This method is called by Inventor when it loads the AddIn.
' The AddInSiteObject provides access to the Inventor Application object.
' The FirstTime flag indicates if the AddIn is loaded for the first time.
' Initialize AddIn members.
m_inventorApplication = addInSiteObject.Application
' Set a reference to the application events.
m_ApplicationEvents = m_inventorApplication.ApplicationEvents
' TODO: Add ApplicationAddInServer.Activate implementation.
' e.g. event initialization, command creation etc.
End Sub
Public Sub Deactivate() Implements Inventor.ApplicationAddInServer.Deactivate
' This method is called by Inventor when the AddIn is unloaded.
' The AddIn will be unloaded either manually by the user or
' when the Inventor session is terminated.
' TODO: Add ApplicationAddInServer.Deactivate implementation
' Release objects.
Marshal.ReleaseComObject(m_inventorApplication)
m_inventorApplication = Nothing
System.GC.WaitForPendingFinalizers()
System.GC.Collect()
End Sub
+ Public ReadOnly Property Automation ...
+ Public Sub ExecuteCommand ...
Private Sub m_ApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor.Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByVal HandlingCode As Inventor.HandlingCodeEnum) Handles m_ApplicationEvents.OnSaveDocument
MsgBox("onSave event")
If (BeforeOrAfter = Inventor.EventTimingEnum.kBefore) Then
MsgBox("about to save " & DocumentObject.FullFileName)
Else
MsgBox(DocumentObject.FullFileName & " has been saved")
End If
End Sub
#End Region
+ "COM Registration"
#End Region
End Class
End Namespace
--------------------------------
und bekomme folgenden
Fehler:
Die Methode "Private Sub m_ApplicationEvents_OnSaveDocument(DocumentObject As Inventor.Document, BeforeOrAfter As Inventor.EventTimingEnum, Context As Inventor.NameValueMap, HandlingCode As Inventor.HandlingCodeEnum)" kann das Ereignis "Public Event OnSaveDocument(DocumentObject As Inventor._Document, BeforeOrAfter As Inventor.EventTimingEnum, Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum)" nicht behandeln, da sie nicht die gleiche Signatur haben.
Kann das leider nicht deuten - kann da bitte jemand helfen
Vielen Dank
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP