...move a file in the recycle bin?

Author: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch

Category: Files

uses ShellAPI; 

function DeleteFileWithUndo(sFileName: string): Boolean;
var 
  
fos: TSHFileOpStruct; 
begin 
  
FillChar(fos, SizeOf(fos), 0); 
  with fos do 
  begin 
    
wFunc  := FO_DELETE; 
    pFrom  := PChar(sFileName); 
    fFlags := FOF_ALLOWUNDO or FOF_NOCONFIRMATION or FOF_SILENT; 
  end
  Result := (0 = ShFileOperation(fos)); 
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base