如何关闭其他目前正在执行的应用程序? ( 积分: 25 )

  • 主题发起人 主题发起人 fongling5355
  • 开始时间 开始时间
F

fongling5355

Unregistered / Unconfirmed
GUEST, unregistred user!
如何关闭其他目前正在执行的应用程序?
 
如何关闭其他目前正在执行的应用程序?
 
uses <br> &nbsp;Tlhelp32; <br><br>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><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)) or (UpperCase(FProcessEntry32.szExeFile) = <br> &nbsp; &nbsp; &nbsp;UpperCase(ExeFileName))) then <br> &nbsp; &nbsp; &nbsp;Result := Integer(TerminateProcess( <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OpenProcess(PROCESS_TERMINATE, <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BOOL(0), <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FProcessEntry32.th32ProcessID), <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0)); <br> &nbsp; &nbsp; ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); <br> &nbsp;end; <br> &nbsp;CloseHandle(FSnapshotHandle); <br>end; <br><br>procedure TForm1.Button1Click(Sender: TObject); <br>begin <br> &nbsp;KillTask('EXCEL.EXE'); <br>end;
 
不错不错,另外备注一下,程序中的 'EXCEL.EXE'不一定是文件名,而是任务管理器的进程列表中的进程名。
 
2楼的正解 不过现在有好多木马是远程线程插入的 不知道怎么**掉
 
后退
顶部