楼主你好:
2个程序代码如下:
SSDPOpeServer.exe 的代码:
namespace SSDPOpeServer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Process[] ps = Process.GetProcesses();
foreach (Process item in ps)
{
if (item.ProcessName=="SSDPOptServer")
{
string str = item.ProcessName;
item.Kill();
}
}
}
SSDPOptServer.exe的代码:
namespace SSDPOptServer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Process[] ps = Process.GetProcesses();
foreach (Process item in ps)
{
if (item.ProcessName=="SSDPOpeServer")
{
string str = item.ProcessName;
item.Kill();
}
}
}
分别创建2个winform小程序,程序均引用using System.Diagnostics;
然后使用下面代码就能达到你要的效果了。呵呵
希望对你有帮助,望采纳,谢谢