After opening Excel with Dsoframer, close dsoframer How to delete this Excel process without judging the milliseconds, to the minute or the second level on the line.
<summary>///will occupy an hour already on the Excel process that has been previously opened by Excel all killed. Open Excel with time, minutes, minutes, and seconds to determine the time to kill Excel process//</summary> public void Killexcelproceed () {T ry {PerformanceCounter PC = new PerformanceCounter ();//performance counter system.diagnostics. Process[] excelprocesses; excelprocesses = System.Diagnostics.Process.GetProcessesByName ("EXCEL"); foreach (System.Diagnostics.Process isprocedding in excelprocesses) {if (ISPROCEDDING.P Rocessname = = "EXCEL") {PC. INSTANCENAME = Isprocedding.processname; DateTime start = Isprocedding.starttime; TimeSpan ss = Datetime.now-start; if (ss. Hours >= 1 | | Ss. Minutes > 10) | | (Startexceltime.day = = start. Day && Startexceltime.hour = = start. Hour && Startexceltime.minute = = start. Minute&& Startexceltime.second = = start. Second && Startexceltime.millisecond = = start. Millisecond)) {if (! isprocedding.hasexited) {try { Isprocedding.kill (); } catch (Exception ex) {} }}}}} catch (Exception ex) { } }
After opening Excel with Dsoframer, close dsoframer How to delete this Excel process