Mega Code Archive

 
Categories / Delphi / Files
 

How to move a file in the recycle bin

Title: How to move a file in the recycle bin 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;