Not able to create inventor instance when Visual studio in Admin mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am getting strange problem when I am trying to create instance of inventor application it is giving me exception when Visual studio is in Admin and If I run same thing in non admin mode then it works fine.
Anybody know what is the problem here ? Please refer below code.
Thanks,
Dinesh
dinesh.gavsane@vaal-triangle.com
static private Inventor.Application Connect()
{
string InventorProgID = "Inventor.Application";
Inventor.Application inventorApp = null;
// Try to get an active instance of Inventor
try
{
inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject(InventorProgID) as Inventor.Application;
}
catch
{
}
// If not active, create a new Inventor session
if (null == inventorApp)
{
Type inventorAppType = Type.GetTypeFromProgID(InventorProgID); // giving exception in Admin mode
if (null != inventorAppType)
{
inventorApp = (Inventor.Application)System.Activator.CreateInstance(inventorAppType) as Inventor.Application;
if (null != inventorApp)
{
// set the flag to indicate we started the Inventor app so we shall quit it.
}
}
}
return inventorApp;
}