silverfrost Site Admin
Joined: 29 Nov 2006 Posts: 191 Location: Manchester
|
Posted: Sun Sep 05, 2004 6:59 pm Post subject: Deleting files to the Recycle Bin |
|
|
Summary
FTN95 does not currently provide a method for deleting files to the recycle bin.
Solution
The Windows API routine "SHFileOperation" can be used to delete files to the recycle bin.
This routine takes a structure as it's only argument which contains all the information on which file(s) to delete and whether to display a dialog box etc. An example of using this routine follows:
Code: |
program recycle_bin_test
include <windows.ins>
type shFileOpStruct
sequence
integer*4 :: hWnd = 0
integer*4 :: wFunc = 0
integer*4 :: pFrom = 0
integer*4 :: pTo = 0
integer*2 :: fFlags = 0
integer*4 :: fAnyOperationsAborted = 0
integer*4 :: hNameMappings = 0
integer*4 :: lpszProgressTitle = 0
end type
integer, parameter :: FO_DELETE = 3
integer, parameter :: FOF_ALLOWUNDO = 64
type(shFileOpStruct) op
character*1024 opFilename
integer opResult
op%wFunc = FO_DELETE
opFilename = "tempfile.txt"//char(0)//char(0)
op%pFrom = loc(opFilename)
op%fFlags = FOF_ALLOWUNDO
opResult = SHFileOperation(op)
end
|
For more information on this routine please see Microsoft's documentation at [url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shfileoperation.asp"]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shfileoperation.asp[/url]
|
|