Having issues with the getobject(, "inventor.application") and the createobject( "inventor.application") with Inventoe 2012
giving me Error "can't create AxtiveX Object"
running from external windows form application VB.net 2010
Can you try to launch Inventor once then check the code again?
Also please post some code around the error if you still see the failure.
‘ Try to get an active instance of Inventor
Try
m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
End Try
' If not active, create a new Inventor session
If m_inventorApp Is Nothing Then
Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application")
m_inventorApp = System.Activator.CreateInstance(inventorAppType)
m_quitInventor = True
End If
Pretty strait forward code. The error that gets thrown is an "Invalid String Exception". I've been able to compile the code and run it on a Windows XP machine, however I am unable to get the code to work on a Windows 7 machine.
Incase you're wondering, I work with Monty.
I have the exact same problem with only one Windows 7 machine, I have about 6 other Win 7 machines that it works on just fine. the only thing that I can figure is that the one I cant get it to work on is a home edition.
May I have more info from you about your OS details(edition, x64 or x86?)? Are you the administrator of the OS, and have your the UAC(user access control) on? Is your Inventor/OS a localized build? And on which line you got the exception(GetActiveObject)? Seems that you have a different exception from Monty's.
Windows 7 Professional x86
The UAC settings are still set at the default levels.
Both builds are localized.
The exception does occur on the "GetActiveObject" line.
r
The exception Monty was discribing is the same issue, just throwing a different exception because that was received using different code. We first started testing this on our own code, in which we use the "GetObject" command. When we couldn't get around the "Cannot create ActiveX control" error we were getting from "GetObject" I switched to the sample code that came in the SDK package for Inventor 2011. That is where the above code came from. I originally thought the problem might be from the fact that I had installed Inventor 2012 on my machine while still having 2011 installed. I have since done a complete uninstall of all Autodesk products following the steps outlined here. I will do another clean uninstall and reinstall and test the code with the UAC settings turned off.
Update:
Disabling the UAC for my computer now allows the "GetActiveObject" line to function as it's supposed to. Also the code now executes the "CreateInstance" line as it's supposed to. Thank you guys for your help.
Recap:
Disabling the UAC settings on my computer fixed this problem. You can access these settings through the Control Panel > User Accounts > Change User Account Control settings.
Hi,
This is very old discussion, but I thought I would add my solution also in case someone else happens to google this same thread in hope of an answer.
I'm using Visual Studio and doing something similar. I had the same issue with the getobject not working with "inventor.application" parameter. The way I fixed this was by switching the .net environment to different version. I was using 5.0 and I got the error with that, but soon as I started a new project and used .net 4.0 the getobject worked just fine.
I'm not sure if you'd be able to get it working by just adding some missing references, but in this way it at least works.
-JuhaP