User Tools

Site Tools


multiple_20file_20operations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
multiple_20file_20operations [2018/03/31 13:19] – external edit 127.0.0.1multiple_20file_20operations [2024/01/05 00:21] (current) – external edit 127.0.0.1
Line 4: Line 4:
 ==== Initialisation ==== ==== Initialisation ====
 \\  Before using the **SHFileOperation** API incorporate the following declarations in your program:\\ \\  \\  Before using the **SHFileOperation** API incorporate the following declarations in your program:\\ \\ 
 +<code bb4w>
         FO_MOVE = 1         FO_MOVE = 1
         FO_COPY = 2         FO_COPY = 2
Line 17: Line 18:
         FOF_SIMPLEPROGRESS = 256 : REM shfo.fFlags.h& = 1         FOF_SIMPLEPROGRESS = 256 : REM shfo.fFlags.h& = 1
         FOF_NOCONFIRMMKDIR = 512 : REM shfo.fFlags.h& = 2         FOF_NOCONFIRMMKDIR = 512 : REM shfo.fFlags.h& = 2
 +</code>
 ==== Deleting files ==== ==== Deleting files ====
 \\  To delete one or more files use code similar to the following:\\ \\  \\  To delete one or more files use code similar to the following:\\ \\ 
 +<code bb4w>
         DEF PROCdeletefiles(afsp$)         DEF PROCdeletefiles(afsp$)
         LOCAL shfo{}         LOCAL shfo{}
Line 26: Line 29:
         shfo.hWnd% = @hwnd%         shfo.hWnd% = @hwnd%
         shfo.wFunc% = FO_DELETE         shfo.wFunc% = FO_DELETE
-        shfo.pFrom% = !^afsp$+        shfo.pFrom% = PTR(afsp$)
         SYS "SHFileOperation", shfo{}         SYS "SHFileOperation", shfo{}
         ENDPROC         ENDPROC
 +</code>
 As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen 'silently' initialise the **fFlags** member as follows:\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen 'silently' initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l& = FOF_SILENT OR FOF_NOCONFIRMATION         shfo.fFlags.l& = FOF_SILENT OR FOF_NOCONFIRMATION
         shfo.fFlags.h& = 0         shfo.fFlags.h& = 0
 +</code>
 You can specify that the files are moved to the Recycle Bin rather than permanently deleted as follows:\\ \\  You can specify that the files are moved to the Recycle Bin rather than permanently deleted as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l& = FOF_ALLOWUNDO OR FOF_NOCONFIRMATION         shfo.fFlags.l& = FOF_ALLOWUNDO OR FOF_NOCONFIRMATION
         shfo.fFlags.h& = 0         shfo.fFlags.h& = 0
 +</code>
 \\  \\ 
 ==== Copying files ==== ==== Copying files ====
 \\  To copy one or more files use code similar to the following:\\ \\  \\  To copy one or more files use code similar to the following:\\ \\ 
 +<code bb4w>
         DEF PROCcopyfiles(from$,dest$)         DEF PROCcopyfiles(from$,dest$)
         LOCAL shfo{}         LOCAL shfo{}
Line 46: Line 55:
         shfo.hWnd% = @hwnd%         shfo.hWnd% = @hwnd%
         shfo.wFunc% = FO_COPY         shfo.wFunc% = FO_COPY
-        shfo.pFrom% = !^from$ +        shfo.pFrom% = PTR(from$) 
-        shfo.pTo% = !^dest$+        shfo.pTo% = PTR(dest$)
         SYS "SHFileOperation", shfo{}         SYS "SHFileOperation", shfo{}
         ENDPROC         ENDPROC
 +</code>
 The **from$** parameter should contain one or more path/filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be copied; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen 'silently' initialise the **fFlags** member as follows:\\ \\  The **from$** parameter should contain one or more path/filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be copied; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen 'silently' initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l& = FOF_SILENT OR FOF_NOCONFIRMATION         shfo.fFlags.l& = FOF_SILENT OR FOF_NOCONFIRMATION
         shfo.fFlags.h& = FOF_NOCONFIRMMKDIR DIV 256         shfo.fFlags.h& = FOF_NOCONFIRMMKDIR DIV 256
 +</code>
 If you want to copy only files, rather than any subdirectories included in the **from$** specification, add the "FOF_FILESONLY" flag.\\ \\  If you want to copy only files, rather than any subdirectories included in the **from$** specification, add the "FOF_FILESONLY" flag.\\ \\ 
 ==== Moving files ==== ==== Moving files ====
 \\  To move (or rename) one or more files use code similar to the following:\\ \\  \\  To move (or rename) one or more files use code similar to the following:\\ \\ 
 +<code bb4w>
         DEF PROCmovefiles(from$,dest$)         DEF PROCmovefiles(from$,dest$)
         LOCAL shfo{}         LOCAL shfo{}
Line 64: Line 77:
         shfo.hWnd% = @hwnd%         shfo.hWnd% = @hwnd%
         shfo.wFunc% = FO_MOVE         shfo.wFunc% = FO_MOVE
-        shfo.pFrom% = !^from$ +        shfo.pFrom% = PTR(from$) 
-        shfo.pTo% = !^dest$+        shfo.pTo% = PTR(dest$)
         SYS "SHFileOperation", shfo{}         SYS "SHFileOperation", shfo{}
         ENDPROC         ENDPROC
 +</code>
 The **from$** parameter should contain one or more path/filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be moved; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen 'silently' initialise the **fFlags** member as follows:\\ \\  The **from$** parameter should contain one or more path/filenames separated by NULs (CHR$0); the filenames may include wildcard characters (? or *). The **dest$** parameter should contain the path to the destination folder to which you want the files to be moved; this folder will be created if necessary.\\ \\  As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen 'silently' initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l& = FOF_SILENT OR FOF_NOCONFIRMATION         shfo.fFlags.l& = FOF_SILENT OR FOF_NOCONFIRMATION
         shfo.fFlags.h& = FOF_NOCONFIRMMKDIR DIV 256         shfo.fFlags.h& = FOF_NOCONFIRMMKDIR DIV 256
 +</code>
 If you want to move only files, rather than any subdirectories included in the **from$** specification, add the "FOF_FILESONLY" flag.\\ \\  If, rather than moving all the files to the same destination folder, you want to move or rename them individually, initialise the **fFlags** member as follows:\\ \\  If you want to move only files, rather than any subdirectories included in the **from$** specification, add the "FOF_FILESONLY" flag.\\ \\  If, rather than moving all the files to the same destination folder, you want to move or rename them individually, initialise the **fFlags** member as follows:\\ \\ 
 +<code bb4w>
         shfo.fFlags.l& = FOF_MULTIDESTFILES         shfo.fFlags.l& = FOF_MULTIDESTFILES
         shfo.fFlags.h& = 0         shfo.fFlags.h& = 0
 +</code>
 Now the **dest$** parameter must contain the same number of path/filename specifications as there are in **from$**, separated by NULs (CHR$0). Now the **dest$** parameter must contain the same number of path/filename specifications as there are in **from$**, separated by NULs (CHR$0).
multiple_20file_20operations.1522502369.txt.gz · Last modified: 2024/01/05 00:17 (external edit)