procedure TForm1.Button2Click(Sender: PObj);
var
Found: BOOL;
HSnapshot, HProcess: THandle;
Lppe: TProcessEntry32;
str:String;
begin
HSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
Lppe.dwSize:=Sizeof(Lppe);
Found:=Process32First(HSnapshot,Lppe);
while Found do
begin
try
if Lppe.szExeFile=ListBox1.Items[ListBox1.CurIndex] then
// if ExtractFilename(Uppercase(Lppe.szExeFile))=ExtractFilename(Uppercase('notepad.exe')) then
begin
HProcess:=OpenProcess(PROCESS_ALL_ACCESS, FALSE, Lppe.th32ProcessID);
//终止进程
TerminateProcess(HProcess,0);
ShowMessage('Process:'+ExtractFilename(Uppercase(Lppe.szExeFile))+' Killed!');
Button1Click(Form1);
Break;
end;
except end;
Found:=Process32Next(HSnapshot,Lppe);
end;
end;
使用以上程序杀掉进程(如天网防火墙的进程pfwmain.exe)后,通过windows 2000的任务管理器
发现天网进程已经不存在,说明进程已经被killed,但此时网络中断,http、ftp、telnet等
将无法连接网络,并造成系统死锁的现象(无法正常关机)。请高手解释一下原因,并提供
kill进程的安全方法,谢谢