PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • 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
// Copie d'un répertoire
Res = fCopyDir("C:\Répertoire\MesFichiers", "D:\Documents\CopieFichier", FiltreFichier)
PROCÉDURE FiltreFichier(sCheminSource, sCheminDestination, flChange, nParamètrePerso)
 
// On ne copie pas les fichiers temporaires
IF fExtractPath(sCheminSource, fExtension) ~= ".tmp"
RETURN fcIgnore
ELSE
RETURN fcCopy
END
Syntax
<Result> = fCopyDir_Callback(<File to copy> , <Destination file> [, <Change> [, <Procedure pointer>]])
<Result>: Integer constant
Copy of the current element:
fcStopUsed to stop the copy permanently.
fcCopyUsed to continue the copy.
fcIgnoreUsed to ignore the copy of a file.
<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:
flFirstFileThe file is the first one listed in the directory of <File to copy>.
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.
<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
Versions 19 and later

Values returned by the procedure

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

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.
New in version 19

Values returned by the procedure

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

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.

Values returned by the procedure

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

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.
Business / UI classification: Neutral code
Component: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment