AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Special cases
  • WLanguage procedure
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Advertencia
A partir de la versión 2024, fTrackDirectory se conserva por motivos de compatibilidad. Esta función ha sido reemplazada por fWatchDirectory.
Detects changes made to the contents of a directory. Only changes made to the files in the directory are detected. If a change is made, a specific procedure is executed in a thread.
Ejemplo
// Name of the directory to be watched
sDirectoryName is string = "C:\Temp\MyDir"
// The fWatchDirectory_Callback procedure will be called 
// when a file or directory in the "C:\Temp\MyDir" directory is modified.  
IF fWatchDirectory(sDirectoryName, fWatchDirectory_Callback, fwCreateFile + ...
		fwModifyFile + fwDeleteFile + fwRename) THEN
	// Notifies the user that the directory will be watched
	Info("The " + sDirectoryName + " directory will be watched.")
ELSE
	// Notifies the user that the directory will not be watched
	Info("The " + sDirectoryName + " directory will not be watched.")
END
// Code of the procedure
PROCEDURE fWatchDirectory_Callback(sDirectoryName, sFileName, nAction, sOldFileName)
ExecuteMainThread(AddTable,sDirectoryName, sFileName, nAction, sOldFileName)
// Procedure that acts on the main thread
PROCEDURE AddTable(sDirectoryName, sFileName, nAction, sOldFileName)

sActionDesignation is string
// The designation of the action depends on nAction
SWITCH nAction
	CASE fsFileCreation: sDesignationAction = "File creation".
	CASE fsDeleteFile: sDesignationAction = "Delete file".
	CASE fsFileModification: sDesignationAction = "File modification".
	CASE fsRename: sDesignationAction = "Rename file".
END
// Add a line containing the information about the modification
// into the TABLE_MODIFICATIONS table
TableAddLine(TABLE_MODIFICATIONS, sDirectoryName, sFileName, , ...
		sActionDesignation, sOldFileName)
Sintaxis
<Result> = fWatchDirectory(<Directory to watch> , <WLanguage procedure> [, <Changes to notify> [, <Subdirectory>]])
<Result>: Boolean
  • True if directory watch is enabled,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Directory to watch>: Character string
Full name of the directory to be watched.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called when a change is made in the specified directory.
For more details on this procedure, see Parameters of the procedure used by fWatchDirectory.
<Changes to notify>: Optional Integer constant (or combination of constants)
Changes made to the contents of the directory to be watched and for which the procedure is to be executed:
fwAllAll actions are watched. Corresponds to fwCreateFile + fwModifyFile + fwRename + fwDeleteFile.
Before version 29 Update 2, this constant was named ftAll.
fwCreateFileCreation of a file or directory.
Before version 29 Update 2, this constant was named ftCreateFile.
fwDeleteFileDeletion of a file or directory.
Before version 29 Update 2, this constant was named ftDeleteFile.
fwModifyFileChanges to a file or directory.
Before version 29 Update 2, this constant was named ftModifyFile.
fwRenameRenaming of a file or directory.
Before version 29 Update 2, this constant was named ftRename.
<Subdirectory>: Boolean
  • True (default) to process the sub-directories.
  • False otherwise.
Observaciones

Special cases

  • fWatchDirectory only watches the contents of the directory. The changes of directory name or location are ignored.
  • To stop watching the directory, use fWatchStop and fWatchStopAll.
  • To watch the changes made to a file, use fWatchFile.
  • Limitation: Only 5 directories can be monitored simultaneously.

WLanguage procedure

The WLanguage procedure is run in a WLanguage thread.
Please note: the following processes cannot be run in threads:
  • opening windows with WLanguage functions such as Open, Use, Close, ... If windows are to be handled in threads (a rare case), a specific management system must be set up. For more details, see Opening a window in a secondary thread.
  • managing events.
  • managing timers.
For more details on threads, see Managing threads.
Componente: wd300std.dll
Versión mínima requerida
  • Versión 18
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

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