Hello,
I have built and tested an API application that can connect to DraftSight and parse through multiple DWG's producing specific output. I need to speed up the scanning process and would like to implement parallel processing using multiple instances of DraftSight.exe. Currently to connect to the API the application must already be running and the Windows Marshal object returns the actively registered object. I would like to be able to launch and connect to multiple instances of DraftSight.exe. Is this possible? Below is a snippet of what I imagine. However, all the HWND are the same. It appears that the answer lies somewhere within the Microsoft COM documentation. Perhaps IRunningObjectTable::GetObject ?
public void LaunchDraftSight() {
Process.Start("cmd", "/C \\"C:\\\\Program Files\\\\Dassault Systemes\\\\DraftSight\\\\bin\\\\DraftSight.exe\\"");
Thread.Sleep(1000);
}
private void buttonLaunchDraftSight_Click(object sender, EventArgs e) {
try {
LaunchDraftSight(); Thread.Sleep(15000); DraftSight.Interop.dsAutomation.Application dsApp = (DraftSight.Interop.dsAutomation.Application)Marshal.GetActiveObject("DraftSight.Application"); int[] HWND = new int[5]; HWND[1] = dsApp.GetHWND();
LaunchDraftSight(); Thread.Sleep(15000); DraftSight.Interop.dsAutomation.Application dsApp2 = (DraftSight.Interop.dsAutomation.Application)Marshal.GetActiveObject("DraftSight.Application"); HWND[2] = dsApp2.GetHWND();
LaunchDraftSight(); Thread.Sleep(15000); DraftSight.Interop.dsAutomation.Application dsApp3 = (DraftSight.Interop.dsAutomation.Application)Marshal.GetActiveObject("DraftSight.Application"); HWND[3] = dsApp3.GetHWND();
HWND[5] = 0;
}
catch { }
}
