C#操作系统进程的代码演示

From , 2 Years ago, written in C#, viewed 231 times.
URL https://pastebin.vip/view/ca91873a
  1.  private bool CloseProcess(string CloseProcessName)
  2.         {
  3.             try
  4.             {
  5.                 //根据进程名称,获取该进程信息
  6.                 Process[] MyProcessS = Process.GetProcessesByName(CloseProcessName);
  7.        
  8.                 foreach (Process MyProcess in MyProcessS)
  9.                 {
  10.                     MyProcess.Kill();
  11.                     MyProcess.WaitForExit();
  12.                     MyProcess.Close();
  13.                     Thread.Sleep(10000);  
  14.                 }
  15.             }
  16.             catch (Exception)
  17.             {
  18.                 return false;                                
  19.             }
  20.             return true;                          
  21.         }
  22.         /// <summary>
  23.         /// 创建进程
  24.         /// </summary>
  25.         public bool StartProcess(string StartProPath)
  26.         {
  27.             try
  28.             {
  29.                 Process TheStartProcess = Process.Start(StartProPath);            
  30.             }
  31.             catch (Exception)
  32.             {
  33.                 return false;                                    
  34.             }
  35.  
  36.             return true;                                        
  37.         }
  38. //csharp/6273

Reply to "C#操作系统进程的代码演示"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website