如何查杀进程!! ( 积分: 100 )

  • 主题发起人 主题发起人 ghalfj
  • 开始时间 开始时间
G

ghalfj

Unregistered / Unconfirmed
GUEST, unregistred user!
如题!!!
 
如题!!!
 
procedure f_CloseProcess(p_ProcessName: String);<br>var<br> &nbsp;v_lppe &nbsp;:TProcessEntry32;<br> &nbsp;v_found :Boolean;<br> &nbsp;v_Hand &nbsp;:THandle;<br>begin<br> &nbsp;v_Hand := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);<br> &nbsp;v_lppe.dwSize:=Sizeof(v_lppe);<br> &nbsp;v_found := Process32First(v_Hand,v_lppe);<br> &nbsp;while v_found do<br> &nbsp;begin<br> &nbsp; &nbsp;if StrPas(v_lppe.szExeFile)=PChar(p_ProcessName) then<br> &nbsp; &nbsp; &nbsp;TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,v_lppe.th32ProcessID),1);<br> &nbsp; &nbsp;v_found := Process32Next(v_Hand,v_lppe);<br> &nbsp;end;<br>end;
 
以上代码,出现这个错误:<br>undeclared identifier:'TProcessEntry32'<br>undeclared identifier:'CreateToolhelp32Snapshot'<br>undeclared identifier:'TH32CS_SNAPALL''
 
function KillTask(ExeFileName: string): integer;<br>const<br> &nbsp;PROCESS_TERMINATE = $0001;<br>var<br> &nbsp;ContinueLoop: BOOL;<br> &nbsp;FSnapshotHandle: THandle;<br> &nbsp;FProcessEntry32: TProcessEntry32;<br>begin<br> &nbsp;result := 0;<br> &nbsp;FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);<br> &nbsp;FProcessEntry32.dwSize := Sizeof(FProcessEntry32);<br> &nbsp;ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);<br> &nbsp;while integer(ContinueLoop) &lt;&gt; 0 do<br> &nbsp;begin<br> &nbsp; &nbsp;if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =<br> &nbsp; &nbsp; &nbsp;UpperCase(ExeFileName))<br> &nbsp; &nbsp; &nbsp;or (UpperCase(FProcessEntry32.szExeFile) =<br> &nbsp; &nbsp; &nbsp;UpperCase(ExeFileName))) then<br> &nbsp; &nbsp; &nbsp;Result := Integer(TerminateProcess(OpenProcess(<br> &nbsp; &nbsp; &nbsp; &nbsp;PROCESS_TERMINATE, BOOL(0),<br> &nbsp; &nbsp; &nbsp; &nbsp;FProcessEntry32.th32ProcessID), 0));<br> &nbsp; &nbsp;ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);<br> &nbsp;end;<br>end;
 
uses TlHelp32;
 
调试已通过,谢谢!!<br>DELPHI中如何调用其它可执行程序?通过网络拷贝文件怎么实现!
 
调用其它程序用WINEXEC是可以,但要拷贝另一台机子的文件用什么命令?
 
后退
顶部