欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#操作windows系統(tǒng)進(jìn)程的方法

 更新時(shí)間:2015年04月28日 11:42:50   作者:igoo  
這篇文章主要介紹了C#操作windows系統(tǒng)進(jìn)程的方法,涉及C#針對(duì)windows操作系統(tǒng)進(jìn)程的創(chuàng)建與關(guān)閉的技巧,需要的朋友可以參考下

本文實(shí)例講述了C#操作windows系統(tǒng)進(jìn)程的方法。分享給大家供大家參考。具體如下:

這段代碼演示了如何根據(jù)進(jìn)程名關(guān)閉進(jìn)程和啟動(dòng)進(jìn)程

/// <summary>
/// 關(guān)閉進(jìn)程
/// </summary>
private bool CloseProcess(string CloseProcessName)
{
 try
 {
  //根據(jù)進(jìn)程名稱,獲取該進(jìn)程信息
  Process[] MyProcessS = Process.GetProcessesByName(CloseProcessName);
  foreach (Process MyProcess in MyProcessS)
  {
   MyProcess.Kill();
   MyProcess.WaitForExit();
   MyProcess.Close();
   Thread.Sleep(10000);
  }
 }
 catch (Exception)
 {
  return false;
 }
 return true;
}
/// <summary>
/// 創(chuàng)建進(jìn)程
/// </summary>
public bool StartProcess(string StartProPath)
{
 try
 {
  Process TheStartProcess = Process.Start(StartProPath);
 }
 catch (Exception)
 {
  return false;
 }
 return true;
}

希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論