Private Structure SHFILEOPSTRUCT
Dim hwnd As Integer
Dim wFunc As Integer
Dim pFrom As String
Dim pTo As String
Dim fFlags As Integer
Dim fAnyOperationsAborted As Integer
Dim hNameMappings As Integer
Dim lpszProgressTitle As String
End Structure
Public Function FileDel(ByRef Path As String) As Integer
'Dim Result As Integer
'Dim FileOP As SHFILEOPSTRUCT
'With FileOP
' .hwnd = 0
' .wFunc = &H3
' .pFrom = Path & vbNullChar & vbNullChar
' .fFlags = &H40 '放进回收站
'End With
'Result = SHFileOperation(FileOP)
If IO.File.Exists(Path) Then
My.Computer.FileSystem.DeleteFile(Path, FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.DoNothing)
End If
End Function
暂时没有评论