VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code demostrate how to send any file to the Recycle Bin using one api call.

by Nedim Sabic (2 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 4th March 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code demostrate how to send any file to the Recycle Bin using one api call.

API Declarations


Private Const ALLOWUNDO=&H40

Private Declare Function SHFileOperation _
Lib "Shell32.dll" _
(FileOp As SHFILEOPSTRUCT)As Long

Private Type SHFILEOPSTRUCT
hWnd As Long
lFunc As Long
sForm As String
sTo As String
iFlags As Integer
boolAnyOperationAborted As Boolean
lNameMappings As Long
sProgressTitle As String
End Type

Rate This code demostrate how to send any file to the Recycle Bin using one api call.



'code wrote by Nedim Sabic
'e-mail [email protected]

Private Sub SendToBin(sFileName As String)
    Dim FileStruct As SHFILEOPSTRUCT
    Dim x As Long

  With FileStruct
     .iFlags=ALLOWUNDO
     .sForm=FileName
     .lFunc=DELETE
  End With
 x=SHFileOperation(FileStruct)
End Sub

Private Sub Command1_Click()
    SendToBin Text1.Text
End Sub

Download this snippet    Add to My Saved Code

This code demostrate how to send any file to the Recycle Bin using one api call. Comments

No comments have been posted about This code demostrate how to send any file to the Recycle Bin using one api call.. Why not be the first to post a comment about This code demostrate how to send any file to the Recycle Bin using one api call..

Post your comment

Subject:
Message:
0/1000 characters