⤷ 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;
More for developers