Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Delete a file to the RecycleBin
If you want to delete a file to the RecycleBin, you can use SHFileOperation procedure with SHFileOpStruct structure.For example, you can do so:
uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject);
var
MyFileStruct: TSHFileOpStruct;
begin
with MyFileStruct do
begin
Wnd:=Form1.Handle;
wFunc:=FO_DELETE;
pFrom:=PChar(Edit1.Text);
fFlags:=FOF_ALLOWUNDO;
end;
try
SHFileOperation(MyFileStruct);
except
on EAccessViolation do Edit1.Text:='';
end;
end;
- Related components
- TFileSearch
- TFolderMonitor
- TFileVersion
-
More for developers