Hmm, maybe you should use blockread() and application.processmessage so you can know how many data has been copied dan give your app a chance to update the proggressbar. copy a file with single line does not give any information. when its done it only show 100% without increment bit by bit from zero.
hope that help you. Regards, Joe --- In [email protected], "rodveilleux" <[EMAIL PROTECTED]> wrote: > > Hello, > Trying to display a progress bar in Delphi 2006 while copying a > large file. My example consists of a VCL Form, > Button,OpenDialog,Gauge and Timer. > My problem is: The bar will not progress while Copy function is > executing. > > Thanks, > Rodney > > Here is my code: > > procedure TForm1.Button1Click(Sender: TObject); > var > FromFile, > ToFile, > Path : string; > begin > if OpenDialog1.Execute then > begin {Create back up copy of DBF file} > Path:= ExtractFilePath(OpenDialog1.FileName); > FromFile:= OpenDialog1.FileName; > ToFile:= Path+'Copy of '+ ExtractFileName(FromFile); > Gauge1.MinValue:= 0; > Gauge1.MaxValue:= 10; > Gauge1.Progress:= Gauge1.MinValue; > Timer1.Enabled:= true; > CopyFile(PChar(FromFile),PChar(ToFile),False); > end; > ShowMessage('Complete'); > Timer1.Enabled:= False; > end; > > procedure TForm1.Timer1Timer(Sender: TObject); > begin > with Gauge1 do > if (Progress < MaxValue) then Progress:= Progress + 1 > else Progress:= 0; > Application.ProcessMessages; > end; >

