Hi,
ich beschäftige mich zur Zeit mit Threads. Leider scheitere ich schon beim Konstruktoraufruf..
so sieht meine ThreadKlasse aus:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48:
| unit Unit2;
interface
uses Classes, sysutils, StdCtrls;
type TDLThread = class(TThread) private count: integer; GUI: TLabel; protected procedure Execute; override; procedure DoSync; protected constructor Create(pGUI: TLabel); end;
implementation
constructor TDLThread.Create(pGUI: TLabel); begin GUI := pGUI;
FreeOnTerminate := True; inherited Create(False); end;
procedure TDLThread.Execute; begin while not terminated do begin count := count + 1; Synchronize(DoSync); end; end;
procedure TDLThread.DoSync(); begin GUI.caption := inttostr(count); end;
end. |
Mein Konstruktoraufruf im ButtonKlick der Form wie folgt:
Delphi-Quelltext
1: 2: 3:
| setlength(dlthreads, 2); dlthreads[0] := tdlthread.Create(label1); dlthreads[0].Resume(); |
Das Problem ist nun, dass er statt meinem Label ein Boolean haben will, "CreateSuspended".
Wer sagt mir, woran das liegt

?
Danke + Grüße
Passi