Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'This program needs a Common Dialog Box, named CDBox.
' (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
' and select Microsoft Common Dialog control)
Private Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
End Type
Private Const FO_DELETE = &H3
Private Const FOF_ALLOWUNDO = &H40
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: [URL unfurl="true"]http://www.allapi.net/[/URL]
'E-Mail: KPDTeam@Allapi.net
Dim SHFileOp As SHFILEOPSTRUCT
'Set the dialog's title
CDBox.DialogTitle = "Select a file to delete ..."
'Set the dialog's filter
CDBox.Filter = "All Files (*.*)|*.*"
'Show the 'Open File' dialog
CDBox.ShowOpen
With SHFileOp
'Delete the file
.wFunc = FO_DELETE
'Select the file
.pFrom = CDBox.filename
'Allow 'move to recycle bn'
.fFlags = FOF_ALLOWUNDO
End With
'perform file operation
SHFileOperation SHFileOp
MsgBox "The file '" + CDBox.filename + "' has been moved to your Recycling Bin !", vbInformation + vbOKOnly, App.Title
End Sub
Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Boolean
hNameMaps As Long
sProgress As String
End Type
Const FO_DELETE = &H3
Const FOF_ALLOWUNDO = &H40
Const FOF_NOCONFIRMATION = &H10
Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Sub TestFileDeletion()
Dim FSpec As String
Dim Result As Boolean
FSpec = "C:\Temp\Test.txt"
Result = DeleteFileToRecycleBin(FSpec)
MsgBox "File " & FSpec & " deletion to Recycle Bin - Success = " & Result
End Sub
Function DeleteFileToRecycleBin(ByVal FName As String, Optional ByVal NoConfirmation As Boolean = False) As Boolean
Dim SHFileOp As SHFILEOPSTRUCT
Dim FlagValues As Long
FlagValues = FOF_ALLOWUNDO
If NoConfirmation Then
FlagValues = FlagValues + FOF_NOCONFIRMATION
End If
With SHFileOp
'Delete the file
.wFunc = FO_DELETE
'Select the file
.pFrom = FName
'Allow move to Recycle Bin
.fFlags = FlagValues
End With
'perform file operation
DeleteFileToRecycleBin = (SHFileOperation(SHFileOp) = 0)
End Function