Ver Mensaje Individual
  #9  
Antiguo 12-08-2012
jonydread jonydread is offline
Miembro
NULL
 
Registrado: nov 2011
Posts: 157
Reputación: 13
jonydread Va por buen camino
mira amigo no se que estoy asiendo mal dejo el codigo donde estoy asiendo pruebas haber si me hechan una manito porfavor
Código Delphi [-]
unit Unit1;

interface

uses
Shellapi,Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
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), nil);

       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.Button1Click(Sender: TObject);
begin
opendialog1.Execute
end;

procedure TForm1.Button2Click(Sender: TObject);
var
i : integer;
begin
for i:= 0 to Opendialog1.Files.Count-1 do
XCopy(Handle, Opendialog1.Files, 'C:\\nuevo');

end;

end.

Última edición por jonydread fecha: 12-08-2012 a las 03:03:14.
Responder Con Cita