Hallo,
es geht!!!!!!!!!!!!!!!!!!!!!!!!
Hier ist der Code:
Delphi-Quellcode:
unit threadtest;
interface
uses
Classes,idtcpclient,dialogs,StdCtrls,sysutils;
type
tmythread =
class(TThread)
private
fclient:tidtcpclient;
fmemo:tmemo;
s:
string;
procedure updatememo;
protected
procedure Execute;
override;
public
constructor create(
const aclient: tidtcpclient;
const amemo: tmemo);
end;
implementation
uses modul;
constructor tmythread.create(
const aclient: tidtcpclient;
const amemo: tmemo);
begin
inherited create(true);
fclient := aclient;
fmemo := amemo;
resume;
end;
procedure tmythread.Execute;
begin
while not terminated
do
begin
s := fclient.readln;
synchronize(updatememo);
sleep(100);
end;
end;
procedure tmythread.updatememo;
begin
fmemo.Lines.Append(s);
end;
end.
Vielen Dank für die Hilfe, besonders an choose und kamil!
Gruß
Spurius