by ANURAG (1 Submission)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
DELETE A FILE WITHOUT ANY DIALOGE BOX AND FILE WILL NOT MOVE TO RECYCLE BIN
API Declarations
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type
'API That will not send file to recycle bin
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_DELETE = &H3
Private Const FOF_SILENT = &H30
'Insert a command button to form and paste code below
Private Sub Command1_Click()
Dim FileOperation As SHFILEOPSTRUCT
Dim lReturn As Long
With FileOperation
.wFunc = FO_DELETE
.pFrom = "c:\aks\anurag.txt"
'Give the file name with Path
'or you can determine the path
.fFlags = FOF_SILENT 'FOF_ALLOWUNDO
End With
lReturn = SHFileOperation(FileOperation)
End Sub
No comments have been posted about DELETE A FILE WITHOUT ANY DIALOGE BOX AND FILE WILL NOT MOVE TO RECYCLE BIN. Why not be the first to post a comment about DELETE A FILE WITHOUT ANY DIALOGE BOX AND FILE WILL NOT MOVE TO RECYCLE BIN.