Si snáď mongol? Tak, ako je to v tom príklade prečo neskúsiš?
TMyThread = class(TThread)
private[
fStatusText : string;
procedure ShowStatus;
protected
procedure Execute; override;
public
Constructor Create(CreateSuspended : boolean);
end;
procedure TMyThread.ShowStatus;
// this method is executed by the mainthread and can therefore access all GUI elements.
begin
Form1.Caption := fStatusText;
end;
procedure TMyThread.Execute;
var
newStatus : string;
begin
fStatusText := 'TMyThread Starting...';
Synchronize(@Showstatus); /// parameter ako ukazateľ na procedúru !!!
fStatusText := 'TMyThread Running...';
while (not Terminated) and ([any condition required]) do
begin
...
[here goes the code of the main thread loop]
...
if NewStatus <> fStatusText then
begin
fStatusText := newStatus;
Synchronize(@Showstatus); /// parameter ako ukazateľ na procedúru !!!
end;
end;
end;