Fórum Copiar arquivo com barra de progresso #399469
19/04/2011
0
procedure TForm1.CopyFileWithProgressBar1(Source, Destination: string);
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 Progressbar1 do
begin
Min := 0;
Max := FileLength;
while FileLength > 0 do
begin
BlockRead(FromF, Buffer[0], SizeOf(Buffer), NumRead);
FileLength := FileLength - NumRead;
BlockWrite(ToF, Buffer[0], NumRead);
Position := Position + NumRead;
end;
CloseFile(FromF);
CloseFile(ToF);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
CopyFileWithProgressBar1('c:\Windows\Welcome.exe', 'c:\temp\Welcome.exe');
end;
Porém ao copiar o arquivo ele muda a data e hora original do arquivo.
Alguém sabe como resolvo isto?
Leandro Carvalho
Curtir tópico
+ 0Posts
22/04/2011
Leandro Carvalho
Gostei + 0
25/04/2011
Wilson Junior
http://www.delphibasics.co.uk/RTL.asp?Name=FileAge
http://delphi.about.com/cs/adptips2001/a/bltip0701_3.htm
Espero ter colaborado.
Gostei + 0
09/06/2011
Moises
Gostei + 0
10/06/2011
Leandro Carvalho
Gostei + 0
10/06/2011
Leandro Carvalho
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)