Hi,
i have a really strange problem, because this code works at some pc's and on some not.
I'm using Inventor 2013 SP 1.1 with Update 2 on Windows 7 64-Bit. All Windows and .NET Updates installed.
Option Explicit On Imports Inventor Public Class Form1 Dim oApp As Inventor.Application Private WithEvents m_miniToolbar As MiniToolbar Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load oApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click m_miniToolbar = oApp.CommandManager.CreateMiniToolbar Dim controls As MiniToolbarControls controls = m_miniToolbar.Controls controls.AddButton("MyButton1", "Winkel", "This is button 1") Dim m_p As Inventor.Point2d = oApp.TransientGeometry.CreatePoint2d(20, 100) m_miniToolbar.Position = m_p m_miniToolbar.Visible = True End Sub End Class
The exeption is thrown at the line "m_miniToolbar.Position = m_p"
I'm sorry, i can just provide the german error message, but here is my translation:
An unhandled exception of the type "System.Runtime.InteropServices.COMException" in mscorlib.dll has occured.
Additional Information: Unspecified error (Exception HRESULT: 0x80004005 (E_FAIL))
See the screenshot in the attachments
Stack Trace:
System.Runtime.InteropServices.COMException wurde nicht behandelt.
ErrorCode=-2147467259
HResult=-2147467259
Message=Unbekannter Fehler (Ausnahme von HRESULT: 0x80004005 (E_FAIL))
Source=""
StackTrace:
bei System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
bei Inventor.MiniToolbarObject.set_Position(Point2d Param)
bei WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\Frederik\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:Zeile 24.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(ApplicationContext context)
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bei WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()
InnerException:
Hi,
Do you have the same installations (same version of Inventor, Visual Studio, etc.) also on machines on which you can reproduce this issue? Is this issue dataset specific? Do you get the same result with/without Inventor addins loaded?
I am asking because I was not able to reproduce it so far...
Thanks,
Jan