ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions / WLanguage procedures
  • Example of values that can be taken by
  • Values returned by the procedure
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
WLanguage procedure called by fCopyDir
WLanguage procedure ("callback") called by fCopyDir for each copied file. This procedure is used to handle the current file.
Example
// Copy a directory
Res = fCopyDir("C:\Directory\MyFiles", "D:\Documents\FileCopy", FilterFile)
PROCEDURE FilterFile(sSourcePath, sDestinationPath, flChange, nCustomParameter)
 
// Don't copy the temporary files
IF fExtractPath(sSourcePath, fExtension) ~= ".tmp"
RESULT fcIgnore
ELSE
RESULT fcCopy
END
Syntax
<Result> = fCopyDir_Callback(<File to copy> , <Destination file> [, <Change> [, <Procedure pointer>]])
<Result>: Integer constant
Copy of the current element:
fcCopyUsed to continue the copy.
fcIgnoreUsed to ignore the copy of a file.
fcStopUsed to stop the copy permanently.
<File to copy>: Character string
Path and name of the file to copy.
<Destination file>: Character string
Path and name of the destination file.
<Change>: Optional integer constant
Used to know if there was a directory change. The possible values are:
flChangeDirThe file is the first one listed in a subdirectory of <File to copy> (this means that the directory has been changed).
flFileAll other cases.
flFirstFileThe file is the first one listed in the directory of <File to copy>.
<Procedure pointer>: Optional integer
Value passed in the <Pointer> of fCopyDir. If <Pointer> is not specified in fCopyDir, <Procedure pointer> is set to 0.
To get the value of <Procedure pointer>, its value must be assigned to the value of <Pointer> in the procedure with Transfer.
Remarks

Example of values that can be taken by <Change>

The following are the different values that can be taken by <Change> when browsing the files copied by fCopyDir:
Current file<Change>
Dir\File 1flFirstFile
Dir\File nflFile
Dir\SubDir 1\File 1flChangeDir
Dir\SubDir 1\File mflFile
Dir\SubDir 2\File 1flChangeDir
Dir\SubDir 2\File xflFile

Values returned by the procedure

The procedure called by fCopyDir must return one of the following values:
fcCopyUsed to continue the copy.
fcIgnoreUsed to ignore the copy of a file.
fcStopUsed to stop the copy permanently.

A WLanguage error occurs if the procedure does not return one of these values.
Case 1. Full interruption of copy
To force the interruption of the copy, the procedure called by fCopyDir must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyDir:
PROCEDURE CopyProduct(PathSourceFile, PathDestinationFile)
...
// Stop requested?
Multitask(-1)
IF KeyPressed(kpEscape) = True THEN
Info("The copy will be stopped")
RESULT fcStop
END
...
RESULT fcCopy

If the Esc key is pressed, the procedure called by fCopyDir returns the fcStop constant.
In any other case (to continue copying), the procedure called by fCopyDir returns the fcCopy constant.
Case 2. Partial interruption of copy
To prevent the procedure called by fCopyFile from being run for a given file, this procedure must return the fcIgnore constant.
Example: The "FindProduct" procedure is automatically called by fCopyDir:
PROCEDURE FindProduct(PathSourceFile, PathDestinationFile)
...
// File to ignore
IF StringEndsWith(PathSourceFile, "WrongFile.XLS") THEN
RESULT fcIgnore
END
...
RESULT fcCopy

To avoid copying the "WrongFile.XLS" file, the procedure returns the fcIgnore constant. The procedure is automatically called for the next copied file, without copying the current file.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/07/2023

Send a report | Local help