Autor Beitrag
NeoXan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81

WinXP Sp1 Home
D7 Prof
BeitragVerfasst: Di 13.01.04 17:00 
Moin,

also ich habe folgendes Problem...dem unten beiligenden SC zurfolge Geht die ProgressBar 3 mal von 0% bis 100%...

Ich würde aber gerne, dass sie genau dann 100% erreicht wenn die for to do schleife richtig abgeschlossen ist... und

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
 
  fs := TFilestream.Create(FileName, fmOpenReadWrite or fmShareExclusive);
  pro1.TotalParts:=0; // <----------------
  pro1.PartsComplete:=0; // <-------------
  pro1.TotalParts:=fs.Size; // <--------------

for i := 1 to 3 do
    begin
      max := fs.Size;
      fs.Position := 0;
      Application.ProcessMessages;
      while max > 0 do
      begin
        if max > SizeOf(buffer) then
          n := SizeOf(buffer)
        else
          n := max;
        fs.Write(Buffer, n);
        max := max - n;
        pro1.PartsComplete:=pro1.TotalParts-max; // <-------------
      end;
      FlushFileBuffers(fs.Handle);
    end;


Moderiert von user profile iconKlabautermann: BBCode im Sourcecode entfernt, da dieser dort nciht funktionieren. Anstelle dessen hinweis Kommentare (// <---------) eingefügt.
Michael Stenzel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 133


D3 Prof, D7 PE
BeitragVerfasst: Mi 14.01.04 00:51 
Hi NeoXan.

Multipliziere par1.TotalParts vor der For - Schleife mit 3.

ausblenden Delphi-Quelltext
1:
pro1.TotalParts := fs.Size * 3;					


Unten in der For - Schleife dann so berechenen.

ausblenden Delphi-Quelltext
1:
pro1.PartsComplete:=pro1.TotalParts-max + pro1.TotalParts * (i-1);					


Mußte eigendlich funktionieren.
Code nicht getestet.

mfg
Michael.