打开文件夹后,如何把一个文件投放到另一个文件!

解决方案 »

  1.   

    procedure MOVEOUT(fromname, todir: string);
    var
      toname: string;
      p_from: pansichar;
      p_to: pansichar;
    begin
      if FileExists(Trim(fromname)) then
      begin
        toname := trim(todir + trim(ExtractFileName(fromname)));
        p_from := @fromname[1];
        p_to := @toname[1];
        if not movefile(p_from, p_to) then
          raise Exception.create('Unable to move file,可能是目的文件已经存在^_^'+fromname);
        newfilename := toname;
      end
      else
        ShowMessage('not exist!!' + fromname);
    end;