Run standalone application from a SWP macro

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

SolidworksApi macros