Thema: Delphi Verzeichnisse kopieren

Einzelnen Beitrag anzeigen

Benutzerbild von cchris
cchris

Registriert seit: 16. Jun 2003
Ort: Taucha
71 Beiträge
 
Delphi 2005 Personal
 
#3

Re: Verzeichnisse kopieren

  Alt 26. Jul 2004, 19:57
Ich hab das jetzt so geändert:

Der Ordner Saves ist vorhanden.

Delphi-Quellcode:

procedure TForm1.Button2Click(Sender: TObject);
var s:string;
begin
s:=inputbox('Namen eingeben...','','');
if not CreateDir(edit1.Text+s) then raise exception.Create(edit1.Text+s+' can''t be created.') else
begin
Listbox2.Items[1]:=Edit1.Text+'Saves\*.*';
Listbox3.Items[1]:=Edit1.Text+s;
DoFileWork(Self.Handle, FO_COPY,Listbox2.Items, Listbox3.Items, FOF_NOCONFIRMATION);
Listbox1.Items.Add(s);
end;
end;
Die Funktion hab ich übernommen:

Delphi-Quellcode:
function DoFileWork(
  aWnd: HWND; aOperation: UINT; aFrom, aTo: TStrings; Flags: FILEOP_FLAGS
  ): Integer;
var
  I: Integer;
  FromPath, ToPath: string;
  SHFileOpStruct: TSHFileOpStruct;
begin
  FromPath := '';
  for I := 0 to aFrom.Count - 1 do
    FromPath := FromPath + aFrom.Strings[I] + #0;
  FromPath := FromPath + #0;

  if Assigned(aTo) then
  begin
    ToPath := '';
    for I := 0 to aTo.Count - 1 do
      ToPath := ToPath + aTo.Strings[I] + #0;
    ToPath := ToPath + #0;
    if aTo.Count > 0 then
      Flags := Flags or FOF_MULTIDESTFILES;
  end;

  with SHFileOpStruct do
  begin
    Wnd := aWnd;
    wFunc := aOperation;
    pFrom := PChar(FromPath);
    if Assigned(aTo) then
    begin
      pTo := PChar(ToPath)
    end else begin // target available
      pTo := nil;
    end; // target not available
    fFlags := aFlags;
  end; // structure
  Result := SHFileOperation(SHFileOpStruct);
end;

Jetzt kommt immer wenn ich versuche das zu kompiliren die Meldung aflags unbekannter Bezeichner. Wenn ich das in Flags ändere kommt dann beim Kopieren: tertz ( oder so ähnlich) kann nicht erstellt werden, obwohl es weder in der Quelle noch im ziel ein Verzeichnis mit dem Namen gibt, noch ne Datei, was maxche ich falsch.
  Mit Zitat antworten Zitat