Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleMove a file into the wastebasket
Keywordswastebasket, recycle bin, delete
CategoriesFiles & Directories, Utilities
 
Use the SHFileOperation API function. The wFunc parameter tells the function what operation to perform. The FOF_ALLOWUNDO flag moves the file into the wastebasket so you can retrieve it later if you like. The FOF_NOCONFIRMATION flag makes the operation not ask the user for confirmation.
 
' Delete the file.
Private Sub CmdDelete_Click()
Dim op As SHFILEOPSTRUCT

    With op
        .wFunc = FO_DELETE
        .pFrom = FilenameText.Text
        If chkConfirm.Value = vbChecked Then
            ' Make the user confirm.
            .fFlags = FOF_ALLOWUNDO
        Else
            ' Do not make the user confirm.
            .fFlags = FOF_ALLOWUNDO Or FOF_NOCONFIRMATION
        End If
    End With
    SHFileOperation op

    MsgBox "Ok"
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated