procedure TForm2.Timer5Timer(Sender: TObject);
var
vQuery: TWmiQuery;
vConnection: TWmiConnection;
down, up : LongInt;
mx, mx1, my, my1, i, ra, ra1 : Integer;
begin
down := 0;
up := 0;
if IsInternetConnected = true
then
begin
Timer6.Enabled := true;
Timer7.Enabled := true;
try
vQuery := TWmiQuery.Create(
nil);
vConnection := TWmiConnection.Create(
nil);
try
vQuery.Connection := vConnection;
vQuery.WQL.Text := '
select * from Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE Name="Sinus 154 stick - Paketplaner-Miniport"';
vQuery.Open;
down := round(vQuery.FieldValues['
BytesReceivedPersec']/1024);
vQuery.WQL.Text := '
select * from Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE Name="Sinus 154 stick - Paketplaner-Miniport"';
vQuery.Open;
up := round(vQuery.FieldValues['
BytesSentPersec']/1024);
finally
vQuery.Free;
vConnection.Free;
end;
except
end;
end;
try
downgesamt := roundto(downgesamt + (down/1024), -2);
upgesamt := roundto(upgesamt + (up/1024), -2);
gesamt := StrToFloat(Label46.Caption) + downgesamt;
Label41.Caption := FloatToStr(downgesamt) + '
MB';
Label40.Caption := FloatToStr(upgesamt) + '
MB';
Label42.Caption := '
Gesamt: ' + FloatToStr(roundto(gesamt/1024,-2)) + '
GB';
except
end;
if down > 125
then down := 125;
if up > 125
then up := 125;
PaintBox3.Refresh;
mx := 33;
my := PaintBox3.Height;
PaintBox3.Canvas.MoveTo(mx, my);
PaintBox3.Canvas.Pen.Color := clNavy;
for i := 0
to 125
do
begin
for ra := 25
downto 10
do
PaintBox3.Canvas.LineTo(Round(mx-ra*cos(i*Pi/180)), Round(my-ra*sin(i*Pi/180)));
end;
PaintBox3.Canvas.MoveTo(mx, my);
PaintBox3.Canvas.Pen.Color := clblue;
for i := 0
to round(down)
do
begin
for ra := 25
downto 10
do
PaintBox3.Canvas.LineTo(Round(mx-ra*cos(i*Pi/180)), Round(my-ra*sin(i*Pi/180)));
end;
PaintBox4.Refresh;
mx1 := 21;
my1 := PaintBox4.Height;
PaintBox4.Canvas.MoveTo(mx1, my1);
PaintBox4.Canvas.Pen.Color := clNavy;
for i := 180
downto 55
do
begin
for ra1 := 25
downto 10
do
PaintBox4.Canvas.LineTo(Round(mx1-ra1*cos(i*Pi/180)), Round(my1-ra1*sin(i*Pi/180)));
end;
PaintBox4.Canvas.MoveTo(mx1, my1);
PaintBox4.Canvas.Pen.Color := clblue;
for i := 180
downto 180 - up
do
begin
for ra1 := 25
downto 10
do
PaintBox4.Canvas.LineTo(Round(mx1-ra1*cos(i*Pi/180)), Round(my1-ra1*sin(i*Pi/180)));
end;
try
if IsInternetConnected = false
then
begin
Label43.Caption := '
IP: 0.0.0.0';
Timer6.Enabled := true;
Timer7.Enabled := false;
Timer5.Enabled := false;
end;
except
end;
end;