Ovo se pokreće unutar Timer kontrole:
Code:
TPingThread.Create(sIpPingHost1, sIpPingHost2, sIpPingHost3, PingCallBack);
TPingThread.Create(sIpPingHost1, sIpPingHost2, sIpPingHost3, PingCallBack);
execute kod:
Code:
procedure TPingThread.Execute;
var
b: boolean;
begin
FIPAddr := FIPAddr1;
Ping(1, b);
Sleep(30);
if not (b) then
begin
FIPAddr := FIPAddr2;
Ping(2, b);
Sleep(30);
if not (b) then
begin
FIPAddr := FIPAddr3;
Ping(3, b);
Sleep(30);
end
end;
_FMain.Timer1.Enabled := not (b);
end;
procedure TPingThread.Execute;
var
b: boolean;
begin
FIPAddr := FIPAddr1;
Ping(1, b);
Sleep(30);
if not (b) then
begin
FIPAddr := FIPAddr2;
Ping(2, b);
Sleep(30);
if not (b) then
begin
FIPAddr := FIPAddr3;
Ping(3, b);
Sleep(30);
end
end;
_FMain.Timer1.Enabled := not (b);
end;
Zanimljiva stvar je da istu stvar koristim u dvije aplikacije, na istom računalu. U jednoj se ne javlja invalid window handle a u drugoj da.
Probao sam maknuti onaj dio _FMain.Timer1.Enable... ali greška se i dalje javlja.
Ako maknem TPingThread.Create... iz Timer1 onda se greška ne javlja, tako da je definitivno problem u tome.
F