AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Löschen von files , by Name Pattern

Ein Thema von bernhard_LA · begonnen am 16. Sep 2016 · letzter Beitrag vom 16. Sep 2016
 
nahpets
(Gast)

n/a Beiträge
 
#6

AW: Löschen von files , by Name Pattern

  Alt 16. Sep 2016, 14:24
Aktuell macht die Funktion nicht so wie ich es will ....
Was macht sie denn? Überhaupt irgendwas? Oder einfach garnix.

SHFileOperation hat ca. 20 unterschiedliche Rückgabewerte. Du prüfst aber nur, ob kein Fehler aufgetreten ist.

Eventuell fragst Du da ja mal etwas genauer ab, um zu erfahren, was denn da so eventuell schiefgelaufen sein könnte.

https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx
Delphi-Quellcode:

function DeleteFiles(const AFile: string): boolean;
var
   sh: SHFileOpStruct;
begin
   Result := false;
   ZeroMemory(@sh, SizeOf(sh));
   with sh do
   begin
     Wnd := Application.Handle;
     wFunc := FO_DELETE;
     pFrom := PChar(AFile +#0);
     fFlags := FOF_SILENT or FOF_NOCONFIRMATION;
   end;
   case SHFileOperation(sh) of
     0 : result := True;
     $71 : ShowMessage('The source and destination files are the same file.');
     $72 : ShowMessage('Multiple file paths were specified in the source buffer, but only one destination file path.');
     $73 : ShowMessage('Rename operation was specified but the destination path is a different directory. Use the move operation instead.');
     $74 : ShowMessage('The source is a root directory, which cannot be moved or renamed.');
     $75 : ShowMessage('The operation was canceled by the user, or silently canceled if the appropriate flags were supplied to SHFileOperation.');
     $76 : ShowMessage('The destination is a subtree of the source.');
     $78 : ShowMessage('Security settings denied access to the source.');
     $79 : ShowMessage('The source or destination path exceeded or would exceed MAX_PATH.');
     $7A : ShowMessage('The operation involved multiple destination paths, which can fail in the case of a move operation.');
     $7C : ShowMessage('The path in the source or destination or both was invalid.');
     $7D : ShowMessage('The source and destination have the same parent folder.');
     $7E : ShowMessage('The destination path is an existing file.');
     $80 : ShowMessage('The destination path is an existing folder.');
     $81 : ShowMessage('The name of the file exceeds MAX_PATH.');
     $82 : ShowMessage('The destination is a read-only CD-ROM, possibly unformatted.');
     $83 : ShowMessage('The destination is a read-only DVD, possibly unformatted.');
     $84 : ShowMessage('The destination is a writable CD-ROM, possibly unformatted.');
     $85 : ShowMessage('The file involved in the operation is too large for the destination media or file system.');
     $86 : ShowMessage('The source is a read-only CD-ROM, possibly unformatted.');
     $87 : ShowMessage('The source is a read-only DVD, possibly unformatted.');
     $88 : ShowMessage('The source is a writable CD-ROM, possibly unformatted.');
     $B7 : ShowMessage('MAX_PATH was exceeded during the operation.');
     $402 : ShowMessage('An unknown error occurred. This is typically due to an invalid path in the source or destination. This error does not occur on Windows Vista and later.');
     $10000 : ShowMessage('An unspecified error occurred on the destination.');
     $10074 : ShowMessage('Destination is a root directory and cannot be renamed.');
  end;
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:08 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz