瀏覽代碼

杀掉全部未关闭的打印进程

章政 8 年之前
父節點
當前提交
9d0c7f8bbd
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      UAS-MES/Main.cs

+ 7 - 0
UAS-MES/Main.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Configuration;
+using System.Diagnostics;
 using System.Drawing;
 using System.IO;
 using System.Runtime.InteropServices;
@@ -78,6 +79,12 @@ namespace UAS_MES
         //窗体加载的时候将headBar的事件委托给指定的函数
         private void Main_Load(object sender, EventArgs e)
         {
+            //杀死全部未关闭的打印进程
+            Process[] processes = System.Diagnostics.Process.GetProcessesByName("lppa");
+            for (int i = 0; i < processes.Length; i++)
+            {
+                processes[i].Kill();
+            }
             thread = new Thread(DeleteLog);
             thread.Start();
             this.Tag = "ShowDialogWindow";