Inventor Customization

Posts: 4
Registered: ‎11-03-2011
Message 1 of 2 (272 Views)

Unhandled Exception while setting the Minitoolbar.Position Property

272 Views, 1 Replies
02-26-2013 11:20 AM



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.
  Message=Unbekannter Fehler (Ausnahme von HRESULT: 0x80004005 (E_FAIL))
       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()




Posts: 20
Registered: ‎09-08-2011
Message 2 of 2 (224 Views)

Re: Unhandled Exception while setting the Minitoolbar.Position Property

02-27-2013 02:22 AM in reply to: Client-04



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...




You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor