PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Displaying in a List Box control the long names of the files found in a directory
fLongName (Example)
Displaying in a List Box control the long names of the files found in a directory
WINDEVReports and QueriesUser code (UMC) The following code is used to:
  • store in an array the name of the files found in a directory (ArrayPath),
  • display in a List Box control the long names of the files found in a directory (LIST_ListLongName)
// Declare and initialize the variables
PathDirFile is string
ResLongName is string
ArrSubscript is int = 0 // Subscript of the array
LoopSubscript is int
ArrayPath is array
 
// Retrieve the first file found in the directory
PathDirFile = fDir("C:\MyDirectories\*.*", frFile)
WHILE PathDirFile <> "" THEN
// Increment the array subscript
ArrSubscript++
// Include the names of the files in the array
ArrayPath[ArrSubscript] = PathDirFile
// Retrieve the next file
PathDirFile = fDir("")
END
FOR LoopSubscript = 1 TO ArrSubscript
// Retrieve the long name
ResLongName = fLongName(ArrayPath[LoopSubscript])
IF ResLongName = "" THEN
// Display an error message if the retrieval was not performed
Error(ErrorInfo(errMessage))
ELSE
// Display long name in a List Box control
ListAdd(LIST_ListLongName, ResLongName)
END
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment