Results 1 to 3 of 3

Thread: Recycle bin

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    ITALY
    Posts
    12

    Post

    How I can delete a file and make it to go into the "recycle bin"?
    thanks

  2. #2
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309

    Post

    Here's a thought:

    Move it to c:\recycled

    You could use FileSystemObject to move the file

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You can use this generic routine I wrote:

    Code:
    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
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 11-23-1999).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width