Send to Recycle Bin: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Updated author and download links, and changed format of some pages.) |
||
Line 45: | Line 45: | ||
</highlight-nsis> | </highlight-nsis> | ||
Page author: Iceman_K | Page author: [[User:Iceman_K|Iceman_K]] |
Revision as of 12:44, 23 April 2005
Description
Silently send a file/files/directory to the Windows Recycle bin instead of permanantly deleting it. This function supports standard windows wildcards. The return value is pushed on the stack. A non-zero value indicates an error.
Usage
Push "c:\temp\xyz.txt" ; File to delete, supports wildcards Call SendToRecycleBin Pop $R0 ; Return code
The Function
Include the following code in your nsi file:
!ifndef FO_DELETE !define FO_DELETE 0x3 !endif !ifndef FOF_SILENT !define FOF_SILENT 0x4 !endif !ifndef FOF_NOCONFIRMATION !define FOF_NOCONFIRMATION 0x10 !endif !ifndef FOF_ALLOWUNDO !define FOF_ALLOWUNDO 0x40 !endif Function SendToRecycleBin Exch $R0 Push $R1 Push $R2 System::Alloc 28 Pop $R1 System::Call "*$R1(i $HWNDPARENT, i ${FO_DELETE}, t '$R0', t '', i ${FOF_ALLOWUNDO}|${FOF_SILENT}|${FOF_NOCONFIRMATION}, i 0, i 0, t '')" System::Call "shell32::SHFileOperationA(i R1)i.R2" System::Free $R1 StrCpy $R0 $R2 Pop $R2 Pop $R1 Exch $R0 FunctionEnd
Page author: Iceman_K