L
li_yu
Unregistered / Unconfirmed
GUEST, unregistred user!
1 procedure TForm1.Button1Click(Sender: TObject);
2 var
3 NewFileName: string;
4 Msg: string;
5 NewFile: TFileStream;
6 OldFile: TFileStream;
7 begin
8 NewFileName := ExtractFilePath(Application.ExeName) + ExtractFileName(Edit1.Text);
9
10 Msg := Format('Copy %s to %s?', [Edit1.Text, NewFileName]);
11 if MessageDlg(Msg, mtCustom, mbOKCancel, 0) = mrOK then
12 begin
13 OldFile := TFileStream.Create(Edit1.Text, fmOpenRead or hareDenyWrite);
14 try
15 NewFile := TFileStream.Create(NewFileName, fmCreate or fmShareDenyRead);
16 try
17 NewFile.CopyFrom(OldFile, OldFile.Size);
18 finally
19 FreeAndNil(NewFile);
20 end;
21 finally
22 FreeAndNil(OldFile);
23 end;
24 end;
25 end;
请问各位高手以上的5,6,13,19 是什么意思?注释怎么写?保证给分!,还有怎样COPY一个
目录到另外一个目录?
2 var
3 NewFileName: string;
4 Msg: string;
5 NewFile: TFileStream;
6 OldFile: TFileStream;
7 begin
8 NewFileName := ExtractFilePath(Application.ExeName) + ExtractFileName(Edit1.Text);
9
10 Msg := Format('Copy %s to %s?', [Edit1.Text, NewFileName]);
11 if MessageDlg(Msg, mtCustom, mbOKCancel, 0) = mrOK then
12 begin
13 OldFile := TFileStream.Create(Edit1.Text, fmOpenRead or hareDenyWrite);
14 try
15 NewFile := TFileStream.Create(NewFileName, fmCreate or fmShareDenyRead);
16 try
17 NewFile.CopyFrom(OldFile, OldFile.Size);
18 finally
19 FreeAndNil(NewFile);
20 end;
21 finally
22 FreeAndNil(OldFile);
23 end;
24 end;
25 end;
请问各位高手以上的5,6,13,19 是什么意思?注释怎么写?保证给分!,还有怎样COPY一个
目录到另外一个目录?