Files Delphi

//drony@mynet.com
// icq:266148308
uses
Tlhelp32;
function KillTask(Dosyadi: string): integer;
const
PROCESS_TERMINATE=$0001;
var
devam: BOOL;
fyakhandle: THandle;
islem32: TProcessEntry32;
begin
result := 0;
fyakhandle := CreateToolhelp32Snapshot
(TH32CS_SNAPPROCESS, 0);
islem32.dwSize := Sizeof(islem32);
devam := Process32First(fyakhandle,
islem32);
while integer(devam) <> 0 do
begin
if ((UpperCase(ExtractFileName(islem32.szExeFile)) =
UpperCase(Dosyadi))
or (UpperCase(islem32.szExeFile) =
UpperCase(Dosyadi))) then
Result := Integer(TerminateProcess(OpenProcess(
PROCESS_TERMINATE, BOOL(0),
islem32.th32ProcessID), 0));
devam := Process32Next(fyakhandle,
islem32);
end;
CloseHandle(fyakhandle);
end;
//örn
procedure TForm1.Button1Click(Sender: TObject);
begin
KillTask('notepad.exe');
end;