2006. november 17., péntek

How to close a non-responding application


Problem/Question/Abstract:

How to close a non-responding application

Answer:

{ ... }
const
  PROCESS_MURDER = $0001;
var
  pid: Cardinal;
  ProcessHandle: THandle;
begin
  { ... }
  GetWindowThreadProcessId(WindowHandleOfHangingApp, @pid);
  ProcessHandle := OpenProcess(PROCESS_MURDER, FALSE, pid);
  TerminateProcess(ProcessHandle, 4);
  { ... }

Nincsenek megjegyzések:

Megjegyzés küldése