Autor Beitrag
rn22
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: So 10.09.06 18:09 
Hallo

ich hab eine Sicherungsroutine programmiert, die eine Dateiliste per Win-API in ein Verzeichnis kopiert (Befehl: TSHFileOpStructA).

Nur wird halt jedes mal gefragt, ob die betr. Datei überschrieben werden soll, weil sie ja schon existiert.

Kann man das unterdrücken?
rn22 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: Mo 11.09.06 12:49 
Titel: Code
nur noch mal zum Verständnis
mein Code sieht so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  files:=files+
  dir+'kassenbuch\Daten\jahre.dat'+#0+
  dir+'daten.dat'+#0+
  dir+'kassierer.dat'+#0+#0;

  with shellinfo do
  begin
       wnd     := Sicherung.handle;
       wfunc   := FO_COPY;
       pFrom   := PChar(files);
       pTo     := PChar(SicherungsPfad);
       //kopieren!
       SHFileOperation(shellinfo);
  end;


und dann tritt halt das oben beschriebene Problem auf...

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Mo 11.09.06 13:01 
Ich würde es eher mit ShellExecute machen. Dos gerät in Vergessenheit. 8) Gebe im Dos-Modus mal copy /? und xcopy /? ein. Du erhälst dann eine Liste der möglichen Kommandozeilenparameter.

_________________
Gruß
Hansa
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 11.09.06 13:13 
Hallo rn22,

schonmal in die Hilfe geschaut? Versuchs mal mit fFlags := FOF_NOCONFIRMATION;.

Gruß Hape!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
rn22 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70



BeitragVerfasst: Mo 11.09.06 18:08 
Ja, das klappt - Danke!

welche Hilfe meinst du ? Bei Windows finde ich nichts dazu
OldGrumpy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 82



BeitragVerfasst: Di 12.09.06 11:58 
Unter anderem findet man solche Sachen auch in der MSDN. Da die Suche in der Onlineversion allerdings echt grausam ist, bedient man sich einfach einer Suchmaschine und findet z.B. mittels der Suchworte "MSDN SHFileOperation" direkt zur entsprechenden Seite :) Der einzig interessante Link dort führt zur Beschreibung des Parameters den SHFileOperation erwartet, und da finden sich dann wirklich allerhand interessante Flags.

Noch ein Wort zu Shellexecute mit xcopy oder sowas: Wenn man diesen Weg benutzt, hat man viel weniger Feedback als bei der Benutzung von SHFileOperation. Ich sag nix gegen DOS und die Kommandozeile, aber ich benutze halt lieber für jeden Zweck das optimale Mittel. Und das wäre hier wirklich SHFileOperation (oder ggf. vorhandene neuere APIs).