下面是我在一个程序中杀进程的过程:<br>可下载文件 http://oopsware.home.chinaren.com/download/TaskMgr08.zip<br>是一个Win9x下的任务管理器<br>procedure TfrmView.Button1Click(Sender: TObject);<br>var<br> i, a: DWORD;<br> s: string;<br> h: THandle;<br>begin { stop process }<br> if Assigned(ListView2.Selected) then begin<br> s:=ListView2.Selected.SubItems[0];<br> if MessageBox(Handle, PChar('确定要结束进程“'+ListView2.Selected.Caption+'”吗?'), '警告', MB_ICONQUESTION+MB_YESNO)<>ID_YES then Exit;<br> i := StrToInt('$'+ListView2.Selected.SubItems[0]);<br> h := OpenProcess(Process_All_Access, True, i);<br> GetExitCodeProcess(h, a);<br> TerminateProcess(h, a);<br> end;<br>end;<br>