uses TLHelp32; procedure TfrmSCCE100.Pvt_EndProcess(AFileName: string); const Cv_PROCESS_TERMINATE=$0001; var Lv_ExeFileName: string; Lv_ContinueLoop: BOOL; Lv_FSnapshotHandle: THandle; Lv_FProcessEntry32: TProcessEntry32; begin Lv_ExeFileName := AFileName; Lv_FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); Lv_FProcessEntry32.dwSize := Sizeof(Lv_FProcessEntry32); Lv_ContinueLoop := Process32First(Lv_FSnapshotHandle,Lv_FProcessEntry32); while Integer(Lv_ContinueLoop) <> 0 do begin if ((UpperCase(ExtractFileName(Lv_FProcessEntry32.szExeFile)) = UpperCase(Lv_ExeFileName)) or (UpperCase(Lv_FProcessEntry32.szExeFile) = UpperCase(Lv_ExeFileName))) then TerminateProcess(OpenProcess(Cv_PROCESS_TERMINATE, BOOL(0),Lv_FProcessEntry32.th32ProcessID), 0); Lv_ContinueLoop := Process32Next(Lv_FSnapshotHandle,Lv_FProcessEntry32); end; end;