B
bigrichcat
Unregistered / Unconfirmed
GUEST, unregistred user!
我在书上抄了一段程序,拷贝文件时显示进度条,可是进度条不显示进度,一直到拷贝结束
才显示直接到了100%,请指教
repeat
BlockRead(SrcFile, Buffer, SizeOf(Buffer), BytesRead);
if BytesRead > 0 then
begin
BlockWrite(DestFile, Buffer, BytesRead, BytesWritten);
if BytesRead <> BytesWritten then
raise Exception.Create('拷贝文件错误')
else begin
TotalRead := TotalRead + BytesRead;
//fcopy.prbCopy.Position := Trunc(TotalRead / Fsize) * 100;
//fcopy.prbCopy.Update;
prbCopy.Position := Trunc(TotalRead / Fsize) * 100;
end;
end
until BytesRead = 0;
才显示直接到了100%,请指教
repeat
BlockRead(SrcFile, Buffer, SizeOf(Buffer), BytesRead);
if BytesRead > 0 then
begin
BlockWrite(DestFile, Buffer, BytesRead, BytesWritten);
if BytesRead <> BytesWritten then
raise Exception.Create('拷贝文件错误')
else begin
TotalRead := TotalRead + BytesRead;
//fcopy.prbCopy.Position := Trunc(TotalRead / Fsize) * 100;
//fcopy.prbCopy.Update;
prbCopy.Position := Trunc(TotalRead / Fsize) * 100;
end;
end
until BytesRead = 0;