Delphi杀死进程代码

网上搜索到的,记录一下备用。
procedure KillProgram(Classname : string; WindowTitle : string);
const
  PROCESS_TERMINATE 
= $0001;
var
  ProcessHandle : THandle;
  ProcessID: Integer;
  TheWindow : HWND;
begin
  TheWindow :
= FindWindow(Classname, WindowTitle);
  GetWindowThreadProcessID(TheWindow, @ProcessID);
  ProcessHandle :
= OpenProcess(PROCESS_TERMINATE, FALSE, ProcessId);
  TerminateProcess(ProcessHandle,
4);
end;

原文地址:https://www.cnblogs.com/erqie/p/1096016.html