[ Home | Contents | Search | Next | Previous | Up ]
Date: 12/1/99
Time: 10:06:41 PM
How do I send a file to the recycle bin from a OWL program and have the animation thingie?
There is a Win32 ShellAPI function for this. It's called SHFileOperation(), the following code deletes the file 'tmp2' from the directory 'c:\tc'. Note that it requires a double null terminate. And also note that if you use wildcards, the files will get deleted, but they won't show up in the recycle-bin.
Using Win32 API
SHFILEOPSTRUCT op;
ZeroMemory(&op,sizeof(op));
op.hwnd=Handle;
op.wFunc=FO_DELETE;
op.pFrom="c:\\tc\\tmp2\0"; // double null terminate
op.fFlags=FOF_ALLOWUNDO;
SHFileOperation(&op);
Or using OWL class TShellItem, advised method:
TShellItem("c:\\tc\\tmp2",true,Handle).Delete(FOF_ALLOWUNDO);