Na 4p jest opisany system zabiania aplikacji znając jej ścieżkę, Cały unit wygląda tak:
unit Delphi;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TLHelp32, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
PHandle : THandle;
FHandle: THandle;
Process : TProcessEntry32;
Done : Boolean;
Next: Boolean;
EXE : String; // ścieżka programu
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
EXE := 'C:\Program Files\Norton AntiVirus\Navw32.exe';
FHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
Process.dwSize := Sizeof(Process);
Next := Process32First(FHandle,Process);
while Next do
begin{ jesli sciezka dostepu sie zgadza }
if AnsiLowerCase(Process.szExeFile) = AnsiLowerCase(EXE) then
begin
PHandle:=OpenProcess(PROCESS_TERMINATE, False,
Process.th32ProcessID);
{ to probujemy zabic aplikacje }
Done := TerminateProcess(PHandle,0);
if not Done then
MessageBox(Handle, 'Błąd', 'Błąd', MB_OK);
end;
Next := Process32Next(FHandle,Process);
end;
CloseHandle(FHandle);
end;
end.
I nie wiem czemu zaznacza mi linijke:
Next := Process32First(FHandle,Process);
i pisze komunikat:
Build
[Error] Delphi.pas(38): Left side cannot be assigned to
[Error] Delphi.pas(39): Type of expression must be BOOLEAN
[Error] Delphi.pas(50): Left side cannot be assigned to
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Delphi.pas'
Za pomoc z góry dziękuje.