multiple_20file_20operations
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
multiple_20file_20operations [2018/03/31 13:19] – external edit 127.0.0.1 | multiple_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& | FOF_SIMPLEPROGRESS = 256 : REM shfo.fFlags.h& | ||
FOF_NOCONFIRMMKDIR = 512 : REM shfo.fFlags.h& | FOF_NOCONFIRMMKDIR = 512 : REM shfo.fFlags.h& | ||
+ | </ | ||
==== 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 " | SYS " | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen ' | As shown the operation will display a progress dialogue and prompt the user for confirmation. If you prefer it to happen ' | ||
+ | <code bb4w> | ||
shfo.fFlags.l& | shfo.fFlags.l& | ||
shfo.fFlags.h& | shfo.fFlags.h& | ||
+ | </ | ||
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& | shfo.fFlags.l& | ||
shfo.fFlags.h& | shfo.fFlags.h& | ||
+ | </ | ||
\\ | \\ | ||
==== 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$, | DEF PROCcopyfiles(from$, | ||
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 " | SYS " | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
The **from$** parameter should contain one or more path/ | The **from$** parameter should contain one or more path/ | ||
+ | <code bb4w> | ||
shfo.fFlags.l& | shfo.fFlags.l& | ||
shfo.fFlags.h& | shfo.fFlags.h& | ||
+ | </ | ||
If you want to copy only files, rather than any subdirectories included in the **from$** specification, | If you want to copy only files, rather than any subdirectories included in the **from$** specification, | ||
==== 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$, | DEF PROCmovefiles(from$, | ||
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 " | SYS " | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
The **from$** parameter should contain one or more path/ | The **from$** parameter should contain one or more path/ | ||
+ | <code bb4w> | ||
shfo.fFlags.l& | shfo.fFlags.l& | ||
shfo.fFlags.h& | shfo.fFlags.h& | ||
+ | </ | ||
If you want to move only files, rather than any subdirectories included in the **from$** specification, | If you want to move only files, rather than any subdirectories included in the **from$** specification, | ||
+ | <code bb4w> | ||
shfo.fFlags.l& | shfo.fFlags.l& | ||
shfo.fFlags.h& | shfo.fFlags.h& | ||
+ | </ | ||
Now the **dest$** parameter must contain the same number of path/ | Now the **dest$** parameter must contain the same number of path/ |
multiple_20file_20operations.1522502369.txt.gz · Last modified: 2024/01/05 00:17 (external edit)