Autor Beitrag
Marduk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Di 08.10.02 10:39 
Hi Leute,
ich hab ein Programm geschrieben, das mit ner idhttp einen download durchführt. Sobald der download läuft reagiert das Programm auf nichts mehr bis der download fertig ist.
Damit da die leutz nich ungeduldig werden würd ich gerne ne progressbar oder n gauge einbauen.
Ich weiss aber überhaupt nicht wie ich den fortschritt des downloads auslesen/erfahren kann.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Di 08.10.02 10:49 
Hi Marduk
ich kann jetzt grade nicht nachschauen, aber wenn ich mich recht erinnere, gibts da ein Ereignis OnWork, das bei Lese- oder Schreiboperationen ausgelöst wird. Da bekommst du geliefert ob gesendet oder empfangen wird und auch die Anzahl der Bytes. Damit sollte sich ein Progressbar angesteuern lassen.
Auf jeden Fall solltest du innerhalb dieses Ereignisses ein Application.ProcessMessages aufrufen, damit die Anwendung noch reagiert.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Marduk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Mo 14.10.02 08:16 
also das mit dem OnWork klingt ja nachdem was ich suche, kann mir vielleicht jemand ein beispiel geben wie ich die bytes auslesen kann ?
hab da leider :( gar keine Vorstellung von.
Danke euch
Dennis
MathiasSimmack
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 14.10.02 11:57 
Stehen diese Angaben denn nicht im Prozedurkopf des "OnWork"-Ereignisses?
Marduk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Mo 14.10.02 13:34 
ausblenden Quelltext
1:
2:
procedure TForm1.IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);

Ist das der Prozedurkopf ???
Also irgendwo muss ich ja warscheinlich zuerst die größe der datei angeben/einlesen, danach immer wieder die heruntergeladenen bytes rausfinden und diese dann in ne prozentzahl umwandeln (heruntergeladen bytes/gesamtbytes)
aber ich weiss eben net wie ich an die werte komm
Marduk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Mo 14.10.02 14:28 
Also ich habe das jetzt so gelöst, muß noch optimiert werden, aber prinzpiell funzt es so:
ausblenden Quelltext
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:
procedure TForm1.IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
var
prozent, max, mom:real;
s:string;

begin
max:=strtoint(maxwert.caption);
mom:=AWorkcount;
momwert.caption:=inttostr(AWorkcount);
prozent:=(mom/max)*100;
str(prozent:0:0,s);
Gauge1.progress:=strtoint(s);



end;

procedure TForm1.IdHTTP1WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
var max:string;

begin

max:=inttostr(AWorkCountMax);
maxwert.caption:=max;
end;
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mo 14.10.02 14:28 
Hi
Ereignisroutine für OnWorkBegin:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.HTTPWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
  ProgressBar1.Position := 0;
  ProgressBar1.Max := AWorkcountMax;
end;


Ereignisroutine für OnWorkEnd:
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure TForm1.HTTPWorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
  //Fertig
  ProgressBar1.Position := 0;
end;


Und die Ereignisroutine für OnWork
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.HTTPWork(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
begin
  if ProgressBar1.Max > 0 then
    ProgressBar1.Position := AWorkCount;
end;


Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mo 14.10.02 14:30 
Oops, Zeitgleich :mrgreen:

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 14.10.02 16:38 
bei den INdy Kompos findest du ich glaube in der regiserer karte INDY MISC eine Komo, die nennt sich TidAntiFreeze. setzt die einfach aufs formular, und schon kann keine indy kompo dein proggi einfrieren !!

Application.processmessages bringt da überhaupt niX!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Marduk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30



BeitragVerfasst: Di 15.10.02 08:03 
super, das ganze funktioniert jetzt, nur:
bei der antifreeze ist mir nicht ganz klar ob das wirklich ein Unterschied ist :? Sobald der Download startet ist es nicht mehr möglich buttons anzuklicken o.ä.
Trotzdem danke an euch alle :)
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Do 17.10.02 17:01 
Hier hast du ein Download ohne Kompo aber mit Progress...
www.faqsen.de/find.j...554850504952555152;2

_________________
Keine Signatur ...