uses tlhelp32,psapi;
【程序编程相关:Callingconventions(调】(1)显示进程列表: 【推荐阅读:ShadowStarCodeFast开发】
【扩展信息:IndySSL-usingcertifi】procedure tform1.button2click(sender: tobject);var lppe: tprocessentry32; found : boolean; hand : thandle; p:dword; s:string; begin listbox1.items.clear ; hand := createtoolhelp32snapshot(th32cs_snapall,0); found := process32first(hand,lppe); while found do begin s := strpas(lppe.szexefile); if lppe.th32processid>0 then p := lppe.th32processid else p := 0; listbox1.items.addobject(s,pointer(p));//列出所有进程. found := process32next(hand,lppe); end; end;(2)杀死某进程:
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); ... 下一页