05-10-2011، 05:06 PM
نقل قول:Delete File !( SHFileOperation )در این سورس شما یاد میگیرید که چگونه با api SHFileOperation یک فایل رو پاک کنید.
کد پیاچپی:
Option Explicit
'//Www.parsiCoders.com
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As Long
End Type
Private Const FO_DELETE = &H3
Private Const FOF_ALLOWUNDO = &H40
Private Sub cmdDelete_Click()
Dim typOperation As SHFILEOPSTRUCT
With typOperation
.wFunc = FO_DELETE
.pFrom = "c:\parsicoders.txt"
.fFlags = FOF_ALLOWUNDO
End With
SHFileOperation typOperation
End Sub