Archive: Recycle rather than delete?


Recycle rather than delete?
The Delete command permanently deletes files. How would I go about having files on the end users' computer moved to their recycle bin instead?


You can call the SHFileOperationA Windows API function using the System plugin. You will need to create the SHFILEOPSTRUCT structure with the FO_DELETE flag before calling the function.


Am I gonna get flamed for saying that I didn't understand a single word of what you just said?


It's not as difficult as you think. An API is a Windows function that can be called from a Windows application. You can call these APIs from an NSIS installer using the System plug-in.

A detailed description of all APIs is available at http://msdn.microsoft.com/library


I wrote a function to do it. You can get it from here.


Cool, man :up:


Thanks!


This is just a programming question, but I haven't found an obvious answer to it so far and I'm curious:

I can understand you Exch $R0 to get the pathname of the file to be recycled into variable $R0, but why then do you Push $R1 and $R2 onto the stack? What do they hold when you push them on? Because you pull $R1 off almost instantly as a value - what's changed it?

Just want to understand a bit more :)

Thanks

Rob


That's only the restore the original value of the variable after calling the function.