On 10/1/06, Felipe Monteiro de Carvalho
<[EMAIL PROTECTED]> wrote:
On 10/1/06, Arí Ricardo Ody <[EMAIL PROTECTED]> wrote:
> I'm writting an application that delete files. Instead of delete them I would
like to put them in the trash. How can I send files to trash?
I went to www.tamaracka.com and searched for "send file recycle bin"
after googling didn´t find anything useful, and here is what I found:
You must use SHFileOperation to move a file to the recycle bin. The
following fragment will do the trick. The example has no error checking, so
you'll want to beef it up for a real application.
procedure DeleteToBin( aFile : String );
var
fileOpStruct : TSHFileOpStruct;
begin
fileOpStruct.Wnd := Handle;
fileOpStruct.wFunc := FO_DELETE;
fileOpStruct.pFrom := aFile;
fileOpStruct.fFlags := FOF_ALLOWUNDO or FOF_SILENT or
FOF_NOCONFIRMATION;
SHFileOperation( fileOpStruct );
end;
I don´t know in which unit these things are, perhaps ShellAPI }
That's ShellAPI (Windows).
On Linux, it's depends on the desktop manager, but there is a
"standard" by freedekstop.org:
http://www.ramendik.ru/docs/trashspec.html
Every Desktop manager that support the standard will do it the same.
> If there are differences between windows and linux, please explain both.
On Linux it even isn´t guaranteed that a Trash exists at all, and
implementations vary from desktop manager to desktop manager.
--
Felipe Monteiro de Carvalho
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives