AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Displaying in a List Box control the short names of the files present in a directory
fShortName (Example)
Displaying in a List Box control the short names of the files present in a directory
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 short names of the files present in a directory (LIST_ListShortName).
// Declare and initialize the variables
PathDirFile is string
ResShortName is string
ArrIndex is int = 0 // Index 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 short name
	ResShortName = fShortName(ArrayPath[LoopSubscript])
	IF ResShortName = "" THEN
		// Display an error message if the retrieval was not performed
		Error(ErrorInfo(errMessage))
	ELSE
		// Display short name in a List Box control
		ListAdd(LIST_ListShortName, ResShortName)
	END
END
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 25/03/2025

Señalar un error o enviar una sugerencia | Ayuda local