private void Close(Param param) { GICO.WriteLine("OriginConnect: Closing Origin.."); if (pOrigin != null) { pOrigin.Visible = MAINWND_VISIBLE.MAINWND_HIDE; pOrigin.Exit(); System.Runtime.InteropServices.Marshal.FinalReleaseComObject(pOrigin); pWorksheet = null; pGraphLayer = null; pDataPlot = null; pOrigin = null; //int hWnd = pOrigin.Application.Hwnd; //Force KILL //uint processID; //GetWindowThreadProcessId((IntPtr)hWnd, out processID); System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName("Origin~1"); foreach (System.Diagnostics.Process p in procs) { //if (p.Id == processID) p.Kill(); } } }
private void Start(bool showDialogBox) { try { pOrigin = new ApplicationSI(); } catch (System.Exception ex) { String strMsg = ResourceException.Origin_FailedPlotting; GICO.WriteLine(strMsg); GICO.WriteLine(ex); return; } //Show o DIALOG BOX do ORIGIN if (showDialogBox) { pOrigin.Visible = MAINWND_VISIBLE.MAINWND_SHOW; } }