Home > Software engineering >  Could you tell me how to do with multiple files deleted to the recycle bin?
Could you tell me how to do with multiple files deleted to the recycle bin?

Time:11-08


To delete a file to the recycle bin, I know, is the following code
Available when the delete multiple files each file popup tooltip,
I want to delete multiple files only pop-up a prompt box, or popup, please do not make prompt box
Ace to give advice or comments please, thank you first!!!
 Private Type SHFILEOPSTRUCT 
Hwnd As Long
WFunc As Long
PFrom As String
Regarding As the String
FFlags As Integer
FAnyOperationsAborted 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=& amp; H3
Private Const FOF_ALLOWUNDO=& amp; H40

Public Sub Recycle (ByVal vFileName As String)
Dim vFileOp As SHFILEOPSTRUCT
Dim RetVal As Long
With vFileOp
. WFunc=FO_DELETE
. PFrom=vFileName
. FFlags=FOF_ALLOWUNDO
End With
RetVal=SHFileOperation (vFileOp)
End Sub


Private Sub Command3_Click ()
Call Recycle (FileName (I))
End Sub

CodePudding user response:

PFrom support into multiple files/directories, and support wildcards,
Multiple files, as long as use vbnullchar space "connected into one string,
Note that end also had better to add a vbnullchar

CodePudding user response:

Just checked the the API information,
Seems to be "into the recycle bin", so each file or directory must use "absolute path,"


Then: click the "request" to speculate that may need to delete into the recycle bin can't use a wildcard,

CodePudding user response:

According to "individual files to delete them one by one, try to add the sign bit:
. FFlags=FOF_ALLOWUNDO or FOF_NOCONFIRMATION

The value of FOF_NOCONFIRMATION for & amp; H10
Said all the "confirmation dialog" automatically choose "is",

CodePudding user response:

reference 3/f a toast to invite the bright moon response:
according to "individual files to delete them one by one, try to add the sign bit:
. FFlags=FOF_ALLOWUNDO or FOF_NOCONFIRMATION

The value of FOF_NOCONFIRMATION for & amp; H10
All said "confirmation dialog" automatically choose "is",

Thank you very much, also trouble you to check information I try first

CodePudding user response:

So, don't ready to post, make rubbish posts rotten street...
His first check the information?
  • Related