在use中加入windows用它里面的filecopy函数就可以了。

解决方案 »

  1.   

    用windows里的copyfile
    procedure TForm1.Button1Click(Sender: TObject);
    var
      ErrorMessage: Pointer;      // holds a system error string
      ErrorCode: DWORD;           // holds a system error code
    begin
      {blank out the status bar}
      StatusBar1.SimpleText:='';  {attempt to copy the file}
      if not CopyFile(PChar(Edit1.Text+'\'+ExtractFilename(FileListBox1.FileName)),
                      PChar(Edit2.Text+'\'+ExtractFilename(FileListBox1.FileName)),                  not CheckBox1.Checked) then
      begin
        {if the file was not copied, display the error message}
        ErrorCode := GetLastError;
        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER or FORMAT_MESSAGE_FROM_SYSTEM,
                      nil, ErrorCode, 0, @ErrorMessage, 0, nil);
        StatusBar1.SimpleText:='Error Copying File: '+string(PChar(ErrorMessage));
        LocalFree(hlocal(ErrorMessage));
      end;
    end;The Tomes of Delphi 3: Win32 Core API Help File by Larry Diehl