CSDN博客

img laoli

杀死一个正在运行的程序

发表于2001/10/5 14:05:00  866人阅读

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;
0 0

相关博文

我的热门文章

img
取 消
img