Ver Mensaje Individual
  #5  
Antiguo 11-08-2012
jonydread jonydread is offline
Miembro
NULL
 
Registrado: nov 2011
Posts: 157
Reputación: 15
jonydread Va por buen camino
ya habia visto ese mensaje pero no se porque no me funciona lo aplico asi
Código Delphi [-]
uses shellapi
procedure CreatePath(Path: string);
var
  l, fin: integer;

begin
   l:= Length(Path);
   fin:= 0;
   repeat
     if (Path[fin] = '\') or (l = 0) then

     begin
       if l>0 then Path[fin]:= #0;
       CreateDirectory(PCHAR(Path), 0);
       if l>0 then Path[fin]:= '\';
     end;

     inc(fin); dec(l);
   until (l<0);
end;
function XCopy(Handle: HWND; From: TStrings; Dest: String): integer;
var
  FS: SHFILEOPSTRUCT;
  SFrom: string;
begin

  Result:= -1;
  if(From.Count > 0) or (Dest <> '') then
  begin
    CreatePath(PCHAR(Dest));
    SFrom:= StringReplace(From.Text, #13+#10, #0, [rfReplaceAll]);

    ZeroMemory(@FS, sizeof(SHFILEOPSTRUCT));
    FS.wnd:= Handle;
    FS.wFunc:= FO_COPY;
    FS.pFrom:= PCHAR(SFrom + #0);
    FS.pTo:=   PCHAR(Dest + #0);
    FS.fFlags:= FOF_NOCONFIRMMKDIR or FOF_NOCONFIRMATION;

    Result:= SHFileOperation(FS);
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
i : integer;
origen, destino: string;
begin
for i:= 0 to Opendialog1.Files.Count-1 do
origen:= opendialog1.Files[i];
destino:=extractpath(opendialog1.Files[i]);
 XCopy(Handle, origen, destino);

end;
Responder Con Cita