Click to See Complete Forum and Search --> : Recycle bin
paolo
Nov 22nd, 1999, 03:42 PM
How I can delete a file and make it to go into the "recycle bin"?
thanks
Inhumanoid
Nov 22nd, 1999, 03:57 PM
Here's a thought:
Move it to c:\recycled
You could use FileSystemObject to move the file
Serge
Nov 22nd, 1999, 08:09 PM
You can use this generic routine I wrote:
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperations
Aborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_DELETE = &H3
Private Const FOF_ALLOWUNDO = &H40
Public Sub DeleteFileToRecycleBin(pstrFileName As String)
Dim FileOperation As SHFILEOPSTRUCT
Dim lRet As Long
With FileOperation
.wFunc = FO_DELETE
.pFrom = pstrFileName
.fFlags = FOF_ALLOWUNDO
End With
lRet = SHFileOperation(FileOperation)
End Sub
Usage: DeleteFileToRecycleBin FileToDelete
Example: DeleteFileToRecycleBin "C:\MyFile.txt"
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 11-23-1999).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.