|
|
|
|
- Example of values that can be taken by
- Complete interruption of fListDirectory
WLanguage procedure called by fListDirectory Procedure ("Callback") called by fListDirectory for each file found. This procedure can be a local, global or internal procedure. // 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: | | flChangeDir | The directory is the first one listed in a subdirectory of <Path> (this means that there has been a change of directory). | flDirectory | All 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 1 | flDirectory | Dir\Directory n | flDirectory | Dir\SubDir 1\Directory 1 | flChangeDir | Dir\SubDir 1\Directory m | flDirectory | Dir\SubDir 2\Directory 1 | flChangeDir | Sub\SubDir 2\Directory x | flDirectory |
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: 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).
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|