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
  • Complete interruption of fListDirectory
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 fListDirectory
Procedure ("Callback") called by fListDirectory for each file found. This procedure can be a local, global or internal procedure.
Example
// Declare and initialize the variables
 
// Number of directories matching the criteria
NbDirectoryLS is int  
NbDirectory is int = 0
SearchCriterion is string
// Select the directory in which the directories will be listed
SearchCriterion = fSelectDir("", "Select a directory", ...
"Searching for hidden directories")
// List of directories
NbDirectoryLS = fListDirectory("C:\MyDocuments", "DirectoryAttribute", ...
&NbDirectoryLS)
// Display the number of files matching the criteria
Info("There are " + NbDirectoryLS + " hidden directories on " + ...
NbDirectory + " listed directories")
// --------------------------------------------------------
// Local procedure called by fListDirectory
PROCEDURE DirectoryAttribute(Directory, Name, Change, NbDirectory)
// Declare the variable
NbDirectoryLS is int
// Hidden directory?
IF Position(fAttribute(Directory + Name), "H") <> 0 THEN
Transfer(&NbDirectoryLS, NbDirectory, 4)
  NbDirectoryLS ++
  Transfer(NbDirectory, &NbDirectoryLS, 4)
  // Display the name of the directory in the "LIST_FileList" list
  ListAdd(LIST_FileList, Directory + Name)
END
RETURN True
Syntax
<Result> = fListDirectory_Callback(<Path> , <Directory name> [, <Change> [, <Procedure pointer>]])
<Result>: Boolean
  • True to continue browsing the files,
  • False to stop browsing the files.
<Path>: Character string
Path of directory used (always ends with "\"; e.g.: "C:\MyFiles\").
<Directory name>: Character string
Name of the directory found.
<Change>: Optional Integer constant
Used to know if there was a directory change. The possible values are:
flChangeDirThe directory is the first one listed in a subdirectory of <Path> (this means that there has been a change of directory).
flDirectoryAll other cases.
<Procedure pointer>: Optional integer
Value passed in the <Pointer> of fListDirectory. If <Pointer> is not specified in fListDirectory, <Procedure pointer> is set to 0.
To retrieve the value of <Procedure pointer>, assign its value to the value of <Pointer> in the procedure with Transfer (see the detailed example at the top of the page).
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 listed by fListDirectory:
Current directory<Change>
Dir\Directory 1flDirectory
Dir\Directory nflDirectory
Dir\SubDir 1\Directory 1flChangeDir
Dir\SubDir 1\Directory mflDirectory
Dir\SubDir 2\Directory 1flChangeDir
Sub\SubDir 2\Directory xflDirectory

Complete interruption of fListDirectory

As long as there are files to browse, fListDirectory cannot be interrupted.
To force the interruption of the complete browse, use the following line in the procedure:
RESULT False
In this case, fListDirectory returns the number of directories browsed until the call to "Result False".
In any other case (to continue the browse), <Procedure name> MUST return True.
An error is generated if <Procedure name> returns no value (neither True nor False).
Component: wd290std.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/22/2022

Send a report | Local help