Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#25

AW: Kann man auch Ordner kopieren???

  Alt 6. Dez 2010, 10:11
Delphi-Quellcode:
procedure Sh_FileCopyMove(aWND: HWND; const Source,Dest: string; DoMove: boolean;
 var IsAborted: boolean; Flags: FILEOP_FLAGS=0);
var
  fos : TSHFileOpStruct;
  s,d: String;
begin
  Result:= False;
  if (Source='') or (Dest='') then exit;
  s:= Source;
  d:= Dest;
  if Source[Length(S)]<> #0 then S:=S+ #0;
  if D[Length(D)]<> #0 then D:=D+ #0;
  ZeroMemory(@fos,SizeOf(fos));
  with fos do
  begin
    Wnd:= aWND;
    If DoMove then wFunc:= FO_Move
    else wFunc:= FO_COPY;
    if Flags=1 then fFlags:=FOF_NOCONFIRMMKDIR or FOF_NOCONFIRMATION or FOF_SILENT or FOF_NOERRORUI
    else fFlags:=Flags;
    fAnyOperationsAborted:= IsAborted;
    pFrom:=PChar(S);
    pTo:=PChar(D);
  end;
  if not (SHFileOperation(fos) = 0) then
    RaiseLastOSError;
  IsAborted:= fos.fAnyOperationsAborted;
end;
Delphi-Quellcode:
try
  Sh_FileCopyMove(...);
except
  on E: Exception do
    ShowMessage(E.Message);
end;
Michael
Ein Teil meines Codes würde euch verunsichern.

Geändert von Luckie ( 6. Dez 2010 um 10:18 Uhr)
  Mit Zitat antworten Zitat