Connecting to specific Inventor instance

Connecting to specific Inventor instance

Anonymous
Not applicable
319 Views
0 Replies
Message 1 of 1

Connecting to specific Inventor instance

Anonymous
Not applicable

Dear reader,

 

I have built an Inventor tool for Inventor 2010. Since I have dfferent versions of Inventor running, I would like to reach out to a specific version.

 

This is the C# code I use

 

            try

            {

                // Attempt to get a reference to a running instance of Inventor.

                oApp = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");

            }

            catch

            {

 

            }

            if (oApp == null)

            {

                try

                {

                    // Start Inventor.

                    System.Type oType = System.Type.GetTypeFromProgID("Inventor.Application");

                    oApp = (Inventor.Application)System.Activator.CreateInstance(oType);

 

                    // Make Inventor visible.

                    oApp.Visible = true;

                }

                catch

                {

                    

                }

            }

 

 

When I run this code on a system where only Inventor 2010 is installed, it works fine. When I run this on a system that has Inventor 2011 or 2012 installed, it allways opens the most recent  version.

I would like to know if it is possible to always let this code start up Inventor 2010, even if 2011 or 2012 is installed.

 

Your help is much appreciated!

 

Best regards,


Klaas

0 Likes
320 Views
0 Replies
Replies (0)