Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DigitTextBox1          = new DigitTextBox();
            DigitTextBox1.Name     = "DigitTextBox1";
            DigitTextBox1.Location = new System.Drawing.Point(80, 15);
            DigitTextBox1.Size     = new System.Drawing.Size(80, 10);
            DigitTextBox1.TabIndex = 1;
            DigitTextBox1.Text     = "";

            DigitTextBox2          = new DigitTextBox();
            DigitTextBox2.Name     = "DigitTextBox2";
            DigitTextBox2.Location = new System.Drawing.Point(80, 40);
            DigitTextBox2.Size     = new System.Drawing.Size(80, 10);
            DigitTextBox2.TabIndex = 2;
            DigitTextBox2.Text     = "";

            this.Controls.Add(DigitTextBox1);
            this.Controls.Add(DigitTextBox2);

            try //Try to get an active instance of Inventor
            {
                try
                {
                    m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;
                }
                catch
                {
                    Type inventorAppType = System.Type.GetTypeFromProgID("Inventor.Application");

                    m_inventorApp = System.Activator.CreateInstance(inventorAppType) as Inventor.Application;

                    //Must be set visible explicitly
                    m_inventorApp.Visible = true;
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("Error: couldn't create Inventor instance");
            }
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DigitTextBox1 = new DigitTextBox();
            DigitTextBox1.Name = "DigitTextBox1";
            DigitTextBox1.Location = new System.Drawing.Point(80, 15);
            DigitTextBox1.Size = new System.Drawing.Size(80, 10);
            DigitTextBox1.TabIndex = 1;
            DigitTextBox1.Text = "";

            DigitTextBox2 = new DigitTextBox();
            DigitTextBox2.Name = "DigitTextBox2";
            DigitTextBox2.Location = new System.Drawing.Point(80, 40);
            DigitTextBox2.Size = new System.Drawing.Size(80, 10);
            DigitTextBox2.TabIndex = 2;
            DigitTextBox2.Text = "";

            this.Controls.Add(DigitTextBox1);
            this.Controls.Add(DigitTextBox2);

            try //Try to get an active instance of Inventor
            {
                try
                {
                    m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;
                }
                catch
                {
                    Type inventorAppType = System.Type.GetTypeFromProgID("Inventor.Application");

                    m_inventorApp = System.Activator.CreateInstance(inventorAppType) as Inventor.Application;

                    //Must be set visible explicitly
                    m_inventorApp.Visible = true;
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("Error: couldn't create Inventor instance");
            }
        }