so gehts:
Delphi-Quellcode:
TSearchThread = class(TThead)
protected
fCancelVar: PBoolean;
procedure Execute(); override;
public
constructor Create(ACancelVar: PBoolean);
end;
[...]
constructor TSearchTread.Create(ACancelVar: PBoolean);
begin
inherited Create(True);
fCancelVar := ACancelVar;
Resume();
end;
procedure TSearchThread.Execute();
begin
fCancelVar := False;
//Search for file until finished or fCancelVar = True
end;
Du übergibst also einen Pointer auf einen Boolean (welcher im Private deiner Form/klasse sein sollte) deinem Thread.