Page 1 of 1

recycle bin

Posted: Fri Dec 06, 2024 4:52 pm
by artnat
Is there a possibility to delete files/directories into the recycle bin in windows?

Re: recycle bin

Posted: Fri Dec 06, 2024 5:11 pm
by Axolotl
you can use the RenameFile() if you know the folder of the Recycle Bin with the help of SHGetSpecialFolderLocation_() and #CSIDL_BITBUCKET.
Or maybe this can help:

Code: Select all

 
#FOF_NOERRORUI = $400 

Procedure RecycleFile(file$)
  m=AllocateMemory(Len(file$)+2)
  If m
    PokeS(m,file$) : SHFileOp.SHFILEOPSTRUCT : SHFileOp\pFrom=m : SHFileOp\wFunc=#FO_DELETE
    SHFileOp\fFlags=#FOF_ALLOWUNDO|#FOF_NOERRORUI : ok=SHFileOperation_(SHFileOp) : FreeMemory(m)
    If ok=0 : ok=1 : Else : ok=0 : EndIf
  EndIf
  ProcedureReturn ok
EndProcedure

RecycleFile("YourFile.txt") ; <== change this to your file. 

Re: recycle bin

Posted: Fri Dec 06, 2024 6:35 pm
by AZJIO
winapi library
You can do a text search in all files, in this case "recycle" and you will always find the answer.
Image