5 Replies Latest reply on Mar 31, 2015 7:04 AM by andrew_french

    EEVX.1: Need help registering 64bit MGCPCBEngines Type Library in Visual Basic .Net

    a.gieger

       

       

       

      Hello,

       

      because of missing debug functionality in vb scripts I use Visual Studio 2010, written in Visual Basic with .Net 4.0.

       

      Just moving from EE7.9.4 to EEVX.1 64bit I have to recompile all Automation stuff with the new type libraries. Documentation gives some hints to the COM version to determine the 64bit version (Common Automation Reference page 9).

       

      First I did a small vb script generating GenCad. It works fine in Xpedition with 'run C:\temp\CreateGenCad.vbs' command

      VB Script code:

      Option Explicit

      Dim app

      Set app = GetObject(, "MGCPCB.ExpeditionPCBApplication.9")

      Dim  docObj

      Set docObj = app.ActiveDocument

       

      if ValidateServer(docObj) Then

             MsgBox("Create GenCad on " & docObj.FullName)

            

             Dim oGenCadEngine

             Set oGenCadEngine = CreateObject("MGCPCBEngines.GeneralInterfaceEngine.9")

             Scripting.AddTypeLibrary("MGCPCBEngines.GeneralInterfaceEngine.9")

       

             oGenCadEngine.DesignFileName = docObj.FullName

             oGenCadEngine.Go

       

             MsgBox("Finish")

      End if

       

       

      Next in Visual Studio 2010, load the 64bit type libraries

      MGCPCB.dll

      MGCPCBAutomationLicensing.dll

      MGCPCBEngines.dll

       

      Now transfer the vb script code to Visual Basic:

          Sub Main()

              Dim app As MGCPCB.Application

              Dim docObj As MGCPCB.Document

              Dim strAppGUID As String

       

              ' Get Arguments, 1.Argument = Programname, 2.Argument = GUID

              Dim args() As String = Environment.GetCommandLineArgs

              If args.Length = 1 Then         

                  app = GetLocalAppInstance()

              Else

                  strAppGUID = args(1).Trim

                  app = GetLocalAppInstance(strAppGUID)       

              End If

              Try

                  docObj = app.ActiveDocument

              Catch ex As Exception

                  MsgBox("There is no design open.", MsgBoxStyle.Critical)

                  Exit Sub

              End Try

       

              If ValidateServer(docObj) Then ' Automation License available ?

                  MsgBox("Create GenCad on " & docObj.FullName)

       

                  Dim oGenCadEngine As MGCPCBEngines.GeneralInterfaceEngine 

                  oGenCadEngine = CreateObject("MGCPCBEngines.GeneralInterfaceEngine.9")

                  Try

                      oGenCadEngine.DesignFileName = docObj.FullName

                      oGenCadEngine.Go()

                  Catch ex As Exception

                      MsgBox("Error:" & ex.Message)

                      Exit Sub

                  End Try

              End If

       

              MsgBox("Finish")

          End Sub

          '************************************************************************

       

       

       

      When running the Visual Basic code, an error appears at oGenCadEngine.DesignFileName = docObj.FullName

       

      It seems the MGCPCBEngines.dll is not successfully registered. But I don't know how to solve.

      Any ideas would be helpful.

      Thanks

      Andreas