Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
Sub FastDeleteFileFolder(temp$$)
If Debug Then Txt.Print FuncName$
Local FileOperation As SHFILEOPSTRUCT, FolderName$$
If LCase$(FolderName$$) = "c:\program files" Then WinBeep(300,200) : WinBeep(300,200) : Exit Sub
If LCase$(FolderName$$) = "c:\program files (x86)" Then WinBeep(300,200) : WinBeep(300,200) : Exit Sub
If LCase$(FolderName$$) = "c:\windows" Then WinBeep(300,200) : WinBeep(300,200) : Exit Sub
If LCase$(FolderName$$) = "c:\users" Then WinBeep(300,200) : WinBeep(300,200) : Exit Sub
FolderName$$ = temp$$ + Nul$(2)
FileOperation.hwnd = %HWND_Desktop
FileOperation.wFunc = %FO_DELETE
FileOperation.pFrom = StrPtr(FolderName$$) 'This string must be double-null terminated.
FileOperation.fFlags = %FOF_NOERRORUI Or %FOF_SILENT Or %FOF_NOCONFIRMATION
SHFileOperation(FileOperation)
End Sub
http://www.garybeene.com/sw/gbsnippets.htm