Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
Function PBMain() As Long
Local iResult As Long, temp As WStringZ * %Max_Path
temp = "c:\_test\z.bas"
If IsFile(temp) Then
iResult = RecycleBin(temp)
If iResult Then ? "Failed" Else ? "Succeeded"
Else
? "File not found!"
End If
End Function
Function RecycleBin(szSource As WStringZ * %Max_Path) As Long
Local shfo As SHFILEOPSTRUCTW
shfo.wFunc = %FO_DELETE
shfo.pFrom = VarPtr(szSource)
shfo.fFlags = %FOF_ALLOWUNDO Or %FOF_NOCONFIRMATION
SHFileOperation(shfo)
Function = shfo.fAnyOperationsAborted '%False=worked %True=failed
End Function
'gbs_01277
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm