using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Diagnostics; using System.Threading;namespace Process测试 { public partial class Form1 : Form { Process p; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { p = Process.Start(@"D:\单机游戏\M01\KartRider.exe"); this.label1.Text = p.HasExited.ToString(); this.label2.Text = p.Id.ToString(); } private void button2_Click(object sender, EventArgs e) { p.Kill(); Thread.Sleep(10000); this.label1.Text = p.HasExited.ToString(); } } }OK,这样说明问题了其实是你打开了这个进程,然后这个进程又去调用了其它的进程,然后将自己关闭掉。所以你只有在打开的那一小会能够关闭它。
Thread.Sleep(50000);
p.Kill();
这种方法不行。。
还是写一个C的驱动吧。直接在Ring0 杀掉进程
{
p = Process.Start(@"D:\单机游戏\M01\KartRider.exe");
this.label1.Text = p.HasExited.ToString();
} private void button2_Click(object sender, EventArgs e)
{
p.Kill();
Thread.Sleep(10000);
this.label1.Text = p.HasExited.ToString();
}其实是可以关闭的,当你马上打开后,马上关闭就OK。继续找问题。。
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;namespace Process测试
{
public partial class Form1 : Form
{
Process p;
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
p = Process.Start(@"D:\单机游戏\M01\KartRider.exe");
this.label1.Text = p.HasExited.ToString();
this.label2.Text = p.Id.ToString();
} private void button2_Click(object sender, EventArgs e)
{
p.Kill();
Thread.Sleep(10000);
this.label1.Text = p.HasExited.ToString();
}
}
}OK,这样说明问题了其实是你打开了这个进程,然后这个进程又去调用了其它的进程,然后将自己关闭掉。所以你只有在打开的那一小会能够关闭它。