Hallo
Ich möchte eine Prozentausgabe des FTP - Download anzeigen, nur leider stürtzt das Programm immer ab.
Ich benutze folgenden Code für den HTTP Download und da funktioniert es problemlos.
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:
| procedure TForm1.IdHTTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer); var STime: String; begin FTime := GetTickCount; FBytes := 0; STime := TimeToStr(Now); end;
procedure TForm1.IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer); var FileSize: Integer; prozent: String; begin if (GetTickCount - FTime) >= 1000 then begin .. FTime := GetTickCount; FBytes := AWorkCount; end; FileSize := IdHTTP1.Response.ContentLength; prozent := IntToStr(AWorkCount * 100 div FileSize); status.caption := 'Ladet: '+prozent+' %';
Application.ProcessMessages; if Abort then begin idHttp1.Disconnect; end; end; |
Jetzt habe ich einfach überall wo http stand ftp geschrieben, es kann zwar komplimiert werden, stürtzt jedoch ab??
Gibt es noch eine andere Möglichkeit?
Gruss