WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

SHFileDelete


;SHFileDelete   -   MWorrel, 10/13/2003
;======================================

;WARNING!!!!  Almost completely untested--use at your own peril!!

#DefineFunction SHFileDelete (FileList,Flags)
OpStruct=BinaryAlloc(32)
pFrom=BinaryAlloc (StrLen(FileList)+ItemCount(FileList,@TAB)+1)

For EachObj=1 To ItemCount (FileList,@TAB)
	ThisObj=ItemExtract (EachObj,FileList,@TAB)
	BinaryPokeStr (pFrom,BinaryEODGet(pFrom),ThisObj)
	BinaryEODSet (pFrom,BinaryEODGet(pFrom)+1)
Next 
BinaryEODSet (pFrom,BinaryEODGet(pFrom)+1)

BinaryPoke4 (OpStruct,4,3)
BinaryPoke4 (OpStruct,8,IntControl(42,pFrom,0,0,0))
BinaryPoke4 (OpStruct,16,Flags)

ShellOp=DllCall (StrCat(DirWindows(1),"Shell32.dll"),long:"SHFileOperationA",lpbinary:OpStruct)
LastErr=DllCall (StrCat(DirWindows(1),"Kernel32.dll"),long:"GetLastError")

BinaryFree(OpStruct)
BinaryFree (pFrom)
Return (ShellOp)
#EndFunction
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Flags:
;FOF_ALLOWUNDO         = 64   ;Preserves undo information, if possible. 
;FOF_CONFIRMMOUSE      = 2    ;Not implemented. 
;FOF_FILESONLY         = 128  ;Performs the operation only on files if a wildcard filename (*.*) is specified. 
;FOF_MULTIDESTFILES    = 1    ;Indicates that the pTo member specifies multiple destination files (one for each source file) rather than one directory where all source files are to be deposited. 
;FOF_NOCONFIRMATION    = 16   ;Responds with "yes to all" for any dialog box that is displayed. 
;FOF_NOCONFIRMMKDIR    = 512  ;Does not confirm the creation of a new directory if the operation requires one to be created. 
;FOF_RENAMEONCOLLISION = 8    ;Gives the file being operated on a new name (such as "Copy #1 of...") in a move, copy, or rename operation if a file of the target name already exists. 
;FOF_SILENT            = 4    ;Does not display a progress dialog box. 
;FOF_SIMPLEPROGRESS    = 256  ;Displays a progress dialog box, but does not show the filenames. 
;FOF_WANTMAPPINGHANDLE = 32   ;Fills in the hNameMappings member. The handle must be freed by using the 
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Files="C:\test\test.txt"
Test=SHFileDelete (Files,64)
Message ("",test)
Exit

Article ID:   W16205
File Created: 2004:03:30:15:43:14
Last Updated: 2004:03:30:15:43:14