Delphi-Quellcode:
type
TCheckThread = class(TThread)
private
FDialog: TProcessingDialog;
procedure DoCheck;
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean);
destructor Destroy; override;
end;
constructor TCheckThread.Create(CreateSuspended: Boolean);
begin
inherited Create(CreateSuspended);
FDialog := TProcessingDialog.Create(Application);
FDialog.ShowModal;
end;
destructor TCheckThread.Destroy;
begin
FDialog.Free;
inherited Destroy;
end;
procedure TCheckThread.DoCheck;
var
//...
begin
MainForm.lblHint.Visible := False;
FDialog.tbProgress.Max := MainForm.CheckedCount;
for I := 0 to MainForm.lvList.Items.Count - 1 do
begin
if Terminated then Exit;
//...
end;
FDialog.Close;
end;
procedure TCheckThread.Execute;
begin
Synchronize(DoCheck);
end;
But after ShowModal it waiting for ModalResult. How I can use modal window inside thread?