threadcopy.pas

来自「虚拟打印机」· PAS 代码 · 共 57 行

PAS
57
字号
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.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?