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 fCopyFile
WLanguage procedure ("callback") called by fCopyFile for each copied file. This procedure is used to get the path of the file to be copied and the associated destination path. For example, this procedure can be used to filter the files to be copied.
This procedure can be a local, global or internal procedure.
Example
// Copy the files found in the "C:\MyImages" directory
ResCopy = fCopyFile("C:\MyImages\*.*", "D:\MyFiles\", fCopyFile_Callback)
 
INTERNAL PROCEDURE fCopyFile_Callback(ToCopy, Destination)
// The procedure is called for each file in the directory.
// The ToCopy parameter contains the name of the file to be copied
// The Destination parameter contains the name of the destination file
// In this example, files with extension ".xlsx" are not copied
IF fExtractPath(ToCopy, fExtension) = ".xlsx" THEN
RESULT fcIgnore
ELSE
// Display the name of the file being copied in a static control
STC_File_InProgress = ToCopy
RESULT fcCopy
END
END
Syntax
<Result> = fCopyFile_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 fCopyFile. If <Pointer> is not specified in fCopyFile, <Procedure pointer> is set to 0.
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 fCopyFile:
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 fCopyFile 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 fCopyFile must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyFile:
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 fCopyFile returns the fcStop constant.
In any other case (to continue copying), the procedure called by fCopyFile 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 fCopyFile:
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 fCopyFile 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 fCopyFile must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyFile:
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 fCopyFile returns the fcStop constant.
In any other case (to continue copying), the procedure called by fCopyFile 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 fCopyFile:
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 fCopyFile 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 fCopyFile must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyFile:
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 fCopyFile returns the fcStop constant.
In any other case (to continue copying), the procedure called by fCopyFile 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 fCopyFile:
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 19
This page is also available for…
Comments
Click [Add] to post a comment