//带进度条的复制文件函数
Procedure CopyFileWithProgressBar(Source, Destination: string; aGauge: TGauge);
var
FromF, ToF : file of byte;
Buffer : array[0..4096] of char;
NumRead : integer;
FileLength : longint;
begin
AssignFile(FromF, Source);
reset(FromF);
AssignFile(ToF, Destination);
rewrite(ToF);
FileLength:=FileSize(FromF);
With aGauge do begin
MinValue := 0; Progress := 0;
MaxValue := FileLength;
while FileLength > 0 do begin
BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);
FileLength := FileLength - NumRead;
BlockWrite(ToF, Buffer[0], NumRead);
Progress := Progress + NumRead;
end;
CloseFile(FromF);
CloseFile(ToF);
end;
end;