السلام عليكم ورحمة الله وبركاته.
أما بعد :
فهذا كود لنسخ ملف ضمن شريط التقدم.
procedure TForm1.CopyFileWithProgressPar(Source,Destination:String); var FormF,ToF : file of Byte; Buffer : array [0 .. 4096] of char; NumRead : Integer; FileLength : Longint; begin AssignFile ( FormF ,Source ); Reset ( FormF ); AssignFile ( ToF ,Destination ); Rewrite ( ToF ); FileLength := FileSize ( FormF ); With ProgressBar1 Do begin Min:=0; Max:=FileLength; while FileLength > 0 do begin BlockRead (FormF,Buffer[0],SizeOf ( Buffer ) ,NumRead); FileLength := FileLength - NumRead; BlockWrite (ToF,Buffer[0],NumRead); Position := Position + NumRead; end; CloseFile( FormF ); CloseFile ( ToF ); end; end;
وهذا كود التنفيذ :
procedure TForm1.Button1Click(Sender: TObject);
begin
CopyFileWithProgressPar('الملف المراد نسخة','الملف الجديد');
end;ولا تنسوني بصالح الدعاء بظهر الغيب.
والله ولي التوفيق.
أخوكم أبو النور.
