盐巴是什么做的?:用什么函数可以中止系统中的进程

来源:百度文库 编辑:高考问答 时间:2024/04/29 06:47:00
用哪个函数可以中止系统中的进程

是通过进程ID号来中止它吗
kill不是删除文件的吗
要是中止进程怎么用
kill (Pid ) 吗

小弟做毕业设计有些API不太懂,
哪位大哥比较熟悉加我qq 啊 113701305 注明API
谢谢啦

使用:TerminateProcess
---------------------------------
delphi片段:
procedure TForm1.Button3Click(Sender: TObject);
var lppe: TProcessEntry32;
found : boolean;
Hand : THandle;
P:DWORD;
sExeFile,sSelect:string;
killed:boolean;
begin
p :=DWORD(ListBox1.Items.Objects[ListBox1.itemindex]);
if P<>0 then
begin
killed := TerminateProcess(OpenProcess(PROCESS_TERMINATE,False,P),$FFFFFFFF);
if not killed then
messagebox(self.handle,pchar(sExeFile+'无法杀死!'),'提示',MB_OK or MB_ICONWARNING)
else
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
end;
--------------------------------
c#片断:
uint h=FindWindow("XLMAIN",System.IntPtr.Zero);
uint p=0;
if(h>0)
{
GetWindowThreadProcessId(h,ref p);
uint tmp=0x0001;
if(p!=0)
TerminateProcess(OpenProcess(tmp,0,p),0xFFFFFFFF);
}
else
break;

Kill

System.exit(0);