[Delphi] Wątki...

0

czemu to nie dziala??

type
Twysylanie = class(TThread)
protected
procedure Execute; override;
end;

var
SMS: array[0..999] of Twysylanie;
Index: Integer = -1;
Wysylanych: Integer;

implementation

{$R *.dfm}

...

Wysylanych := ListView1.Items.Count - 1;
for I:=0 to ListView1.Items.Count - 1 do
begin
Index := I;
SMS[I] := Twysylanie.Create(false);
Sleep(10);
end;
...

{ Twysylanie }

procedure Twysylanie.Execute;
var
S: Integer;
Numer,Testn: String;
begin
FreeOnTerminate := True;
S := Index;
Numer := Copy(Form3.ListView1.Items[S].SubItems[0], 3, Length(Form3.ListView1.Items[S].SubItems[0]));
Testn := Numer[1]+Numer[2]+Numer[3];

if (Testn = '500') or (Testn = '501') or (Testn = '502') or (Testn = '503') or
(Testn = '504') or (Testn = '505') or (Testn = '506') then
Form3.ListView1.Items[S].ImageIndex := WyslijIDEA(Numer)
else if (Testn = '600') or (Testn = '602') or (Testn = '604') or (Testn = '606') or
(Testn = '608') or (Testn = '690') or (Testn = '692') or (Testn = '694') then
Form3.ListView1.Items[S].ImageIndex := WyslijERA(Numer)
else
Form3.ListView1.Items[S].ImageIndex := WyslijPLUS(Numer);
end;

PS: Jak uruchomić wątek z jakims parametrem??
(żeby nie kombinowac z tymi Index'ami i Wysylany'mi)

Z góry dzięki--[ Delphi... i wszystko jasne ]

0

TheChoseN napisał:
czemu to nie dziala??
PS: Jak uruchomić wątek z jakims parametrem??
(żeby nie kombinowac z tymi Index'ami i Wysylany'mi)

type
Twysylanie = class(TThread)
private
FParam1: TPParametr1;
FParam2: TPParametr2;
public
constructor Create(Parametr1: TPParametr1; Parametr1: TPParametr1);
protected
procedure Execute; override;
end;

constructor TWysylanie.Create(Parametr1: TPParametr1; Parametr1: TPParametr1);
begin
FParam1 := Parametr1;
FParam2 := Parametr2;
FreeOnTerminate := True;
inherited Create(False);
end;

Z tego samego powodu to nie działa. Nie napisałeś konstruktora.--Jest jeszcze jeden błąd ... :)

Apel: Piszcie w tematach o jaki język programowania chodzi np. : [Delphi], [C++], itp.

1 użytkowników online, w tym zalogowanych: 0, gości: 1