ديدم هيشكي كار نمي كنه پس ما شروعش كرديم بچه عضو ادامه بدن سايت فعال كنيم
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
ProgressBar1: TProgressBar;
Button1: TButton;
procedure Button1Click( Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure CopyFileWithProgres sBar1(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 Form1.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
CopyFileWithProgres sBar1(GetCurrent Dir +'\test.txt' ,'c:\test. txt');
ShowMessage( 'Copy Finished ! ... ');
end;
end.