PDA

View Full Version : ending processes



gisler
27-09-2007, 06:54 PM
o/s: windows
IDE: delphi 7
Libraries: unknown

hello,

i am trying to end a process in the windows task manager through delphi. i have managed to search the proceses and find the one i need to end but can't seem to figure out how to stop it from running.

many thanks

arthurprs
27-09-2007, 08:04 PM
WinExec(Pchar('TaskKill /F /IM ' + 'application.exe'), SW_HIDE);

=) replace application.exe for process you want to kill

User137
27-09-2007, 08:41 PM
Also this function kills application, with parameter that is full Title of application shown in taskbar.

function KillApp(const sCapt: PChar): boolean; var AppHandle:THandle;
begin
AppHandle:=FindWindow(Nil, sCapt);
Result:=PostMessage(AppHandle, WM_QUIT, 0, 0);
end;