Results 1 to 2 of 2

Thread: Delete - Files/Folders

  1. #1

    Thread Starter
    Addicted Member sinner0636's Avatar
    Join Date
    Sep 2009
    Posts
    233

    Delete - Files/Folders

    hi i was wondering i am using a win32 api method to del files/folders to windows Recycle Bin but it displays a msgbox for each file i want to delete "are you sure you want to del file to recycle bin?" how do del them without this msgbox?? Is there a way??


    Code:
    Private Type SHFILEOPTSTRUCT
      hWnd As Long
      wFunc As Long
      pFrom As String
      pTo As String
      fFlags As Integer
      fAnyOperationsAborted As Long
      hNameMappings As Long
      lpszProgressTitle As Long
    End Type
    
    Public Declare Function SHFileOperation Lib "Shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPTSTRUCT) As Long
    
    Public Sub DeleteFileToRecycleBin(Filename As String)
    
    Dim fop As SHFILEOPTSTRUCT
    
    With fop
      .wFunc = FO_DELETE
      .pFrom = Filename
      .fFlags = FOF_ALLOWUNDO
    End With
    
    SHFileOperation fop
    
    End Sub

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Delete - Files/Folders

    You could try
    Code:
    Private Const FOF_NOCONFIRMATION = &H10             
    
    With fop
      .wFunc = FO_DELETE
      .pFrom = Filename
      .fFlags = FOF_ALLOWUNDO Or FOF_NOCONFIRMATION
    End With

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