Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Send files to the recycle bin
This article has not been rated yet. After reading, feel free to leave comments and rate it.
If you don't like to use DeleteFile, because it removes files from the hard disc
completely, you might want to use the following function which removes files, but
optionally allows an undo:
 | |  | | procedure RecycleFile(s : string);
var
SHFileOpStruct : TSHFileOpStruct;
begin
with SHFileOpStruct do
begin
Wnd := 0;
wFunc := FO_DELETE;
pFrom := PChar(s+#0+#0);
pTo := nil;
fFlags := FOF_ALLOWUNDO;
hNameMappings := nil;
lpszProgressTitle := nil;
end;
SHFileOperation(SHFileOpStruct);
end; | |  | |  |
Comments:
|