Author: Tomas Rutkauskas How to kill an application without any confirmation Answer: The following code searches for Notepad, and kills it - no questions asked. Use 1 WinHwnd := FindWindow(classname, nil); 2 3 //or 4 5 WinHwnd := FindWindow(nil, 'window-caption'); 6 7 //with your apps details. 8 9 procedure TForm1.ButtonClick(Sender: TObject); 10 var 11 ProcessHandle: THandle; 12 WinHwnd: HWND; 13 ProcessID, ExitCode: Integer; 14 begin 15 ProcessID := 0; 16 ExitCode := 0; 17 WinHwnd := FindWindow('NotePad', nil); 18 if not (IsWindow(WinHwnd)) then 19 begin 20 ShowMessage('NotePad not found'); 21 exit; 22 end; 23 GetWindowThreadProcessID(WinHwnd, @ProcessID); 24 ProcessHandle := OpenProcess(PROCESS_CREATE_THREAD or PROCESS_VM_OPERATION 25 or PROCESS_VM_WRITE or PROCESS_VM_READ or 26 PROCESS_TERMINATE, False, ProcessID); 27 if (ProcessHandle > 0) then 28 begin 29 GetExitCodeProcess(ProcessHandle, ExitCode); 30 { or GetExitCodeProcess(ProcessHandle, DWORD(ExitCode)); } 31 TerminateProcess(ProcessHandle, ExitCode); 32 CloseHandle(ProcessHandle); 33 end 34 else 35 ShowMessage('Unable to get proccess Handle'); 36 end;