Ver Mensaje Individual
  #1  
Antiguo 22-04-2021
LACV LACV is offline
Miembro
 
Registrado: oct 2015
Posts: 80
Reputación: 9
LACV Va por buen camino
Exclamation copiar archivos de un directorio a otro

Buena tarde

estoy intentando copiar archivos de un directorio pero no se que error estoy cometiendo ya que no me lo permite por que no tiene acceso


Código Delphi [-]

//esta es la función para llevar el proceso de la rutina 

function ProgressRoutine(TotalFileSize, TotalBytesTransferred, StreamSize,
  StreamBytesTransferred: LARGE_INTEGER;
  dwStreamNumber, dwCallbackReason: DWORD;
  hSourceFile, hDestinationFile: THandle; lpData: Pointer): DWORD;
var
  Value: integer;
begin
  Application.ProcessMessages();
  if (dwCallbackReason = CALLBACK_CHUNK_FINISHED) then
    FrmUpdateCopy.bp.Progress := (int64(TotalBytesTransferred) * 100)
      div int64(TotalFileSize);

  Result := PROGRESS_CONTINUE;
end;


//con el botón utilizo el copyfileex para poder realizar el copiado de los datos pero me arroja que los archivos no tienen permiso 

procedure TFrmUpdateCopy.BtnIniciarClick(Sender: TObject);
var
  Fuente, Destino: PChar;
begin

  Fuente := PChar(ExtractFilePath(Application.ExeName) +
    '\data\c\temp\update\');
  Destino := PChar(ExtractFilePath(Application.ExeName));

  Cancel := false;
  CopyFileEx(Fuente, Destino, @ProgressRoutine, nil, @Cancel, 0);
  ShowMessage(SysErrorMessage(GetLastError()));
end;

de antemano les agradesco
Responder Con Cita