threadcopy.pas
上传用户:yuandong
上传日期:2022-08-08
资源大小:954k
文件大小:1k
- unit threadcopy;
- interface
- uses
- Classes, Windows;
- type
- { CThreadCopy }
- CThreadCopy = class(TThread)
- private
- { Private-Deklarationen }
- strOld, strNew : string;
- bOverwr : WordBool;
- protected
- procedure Execute; override;
- procedure Copy(var strOldFile : string; var strNewFile : string; bOverwrite : WordBool); virtual; abstract;
- public
- constructor Create(var strOldFile : string; var strNewFile : string; bOverwrite : WordBool);
- end;
- { TCopyFile }
- TCopyFile = class(CThreadCopy)
- protected
- procedure Copy(var strOldFile : string; var strNewFile : string; bOverwrite : WordBool); override;
- end;
- implementation
- { CThreadCopy }
- procedure CThreadCopy.Execute;
- begin
- { Thread code }
- Copy(strOld, strNew, bOverwr);
- end;
- constructor CThreadCopy.Create(var strOldFile : string; var strNewFile : string; bOverwrite : WordBool);
- begin
- strOld := strOldFile;
- strNew := strNewFile;
- bOverwr := bOverwrite;
- FreeOnTerminate := True;
- inherited Create(False);
- end;
- { TCopyFile }
- procedure TCopyFile.Copy(var strOldFile : string; var strNewFile : string; bOverwrite : WordBool);
- begin
- CopyFile(PChar(strOldFile), PChar(strNewFile), bOverwrite);
- end;
- end.