// Copy a file using a TFileStream object<br><br>procedure FileCopy( const Source, Dest : string );<br>var<br> S, D: TFileStream;<br>begin<br> S := TFileStream.Create( Source, fmOpenRead );<br> try<br> D := TFileStream.Create( Dest,<br> fmOpenWrite or fmCreate );<br> try<br> D.CopyFrom( S, S.Size );<br> finally<br> D.Free;<br> end;<br> finally<br> S.Free;<br> end;<br>end;<br><br><br>// Copy a file using LZCopy <br>// LZCopy is implemented in the LZExpand.dll that ships with Windows. The interfaces to the functions are in the LZExpand unit.<br><br>procedure CopyFile( Source, Dest : string );<br>var<br> S, D : File;<br>begin<br> AssignFile( S, Source );<br> AssignFile( D, Dest ); <br> Reset( S );<br> try<br> Rewrite( D ); <br> try<br> if LZCopy( TFileRec( S ).Handle,<br> TFileRec( D ).Handle ) < 0 then<br> raise EInOutError.Create('Error using LZCopy');<br> finally<br> CloseFile( D );<br> end;<br> finally<br> CloseFile( S );<br> end;<br>end;<br><br><br>// 自己再把有关进度的部分加进去<br>