C
crazymoon
Unregistered / Unconfirmed
GUEST, unregistred user!
用在定时器里,一会就死机<br>try<br> closehandle(HSnapshot);<br>except<br> end;<br> HSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br> Lppe1.dwSize:=Sizeof(Lppe);<br> Found1:=Process32First(HSnapshot,Lppe1);<br> while Found1 do<br> begin<br> try<br> if Lppe1.szExeFile=ExeFileName then<br> begin<br> try<br> HProcess:=OpenProcess(PROCESS_ALL_ACCESS or PROCESS_TERMINATE,FALSE,Lppe1.th32ProcessID);<br> //终止进程<br> result:= TerminateProcess(HProcess,0) ;<br> try<br> closehandle(HProcess);<br> except<br> end;<br> exit;<br> except<br> end;<br> exit;<br> end;<br> except<br> end;<br> Found1:=Process32Next(HSnapshot,Lppe1);<br> end;<br>