7 Replies Latest reply on Jul 7, 2015 5:37 AM by Alexandre Gragnano

    Run standalone application from a SWP macro

    Alexandre Gragnano

      Hi everyone,

       

      I would like to run a standalone C# application from a VBA SWP launcher by passing the SolidWorks process id as argument in case of multiple SolidWorks instances.

       

      macro.swp (VBA launcher)

      ---------------------------------------------------------------------------------------------------------

      Sub Main()
          Shell """C:\...\macro.exe"" " + CStr(Application.SldWorks.GetProcessID)
      End Sub

       

       

      macro.exe (C# standalone application)

      ---------------------------------------------------------------------------------------------------------

      static void Main(string[] args)
      {
          int processId = Convert.ToInt32(args[0]);
          Process process = Process.GetProcessById(processId);
          // How to get SldWorks instance from process?
      }

       

       

      Need help

      Best regards