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, fTrackFile se conserva por motivos de compatibilidad. Esta función ha sido reemplazada por fWatchFile.
Starts watching a file. In case of file modification, a specific procedure is run in a thread.
Ejemplo
// Nom du fichier à surveiller
sNomFichier is string = "C:\Temp\MonRep\MonFichier.extension"
// La procédure TraiteModification sera appelée lorsque le fichier 
// "C:\Temp\MonRep\MonFichier.extension" sera modifié.
IF fWatchFile(sNomFichier, fSurveilleFichier_Callback, ...
		fwCreateFile + fwModifyFile + fwDeleteFile + ...
		fwRename) THEN
	// On informe l'utilisateur de la mise sous surveillance du fichier
	Info("La mise sous surveillance du fichier " + sNomFichier + " a réussi.")
ELSE
	// On informe l'utilisateur de l'échec de la mise sous surveillance du fichier
	Info("La mise sous surveillance du fichier " + sNomFichier + " a échoué.")
END

// Code de la procédure interne
INTERNAL PROCEDURE fSurveilleFichier_Callback(sNomComplet, sNomFichierSurveille, nAction, sAncienNomFichier)
	sDesignationAction is string
	// La désignation de l'action subie dépend de nAction
	SWITCH nAction
		CASE fwCreateFile: sDesignationAction = "Création de fichier"
		CASE fwDeleteFile: sDesignationAction = "Suppression de fichier"
		CASE fwModifyFile: sDesignationAction = "Modification de fichier"
		CASE fwRename: sDesignationAction = "Renommage de fichier"
	END
	// Ajout d'une ligne contenant les informations de la modification 
	// dans le champ Table TABLE_MODIFICATIONS
	TableAddLine(TABLE_MODIFICATIONS, sNomComplet, sNomFichierSurveille, ...
		sDesignationAction, sAncienNomFichier)
END
Sintaxis
<Result> = fWatchFile(<File to watch> , <WLanguage procedure> [, <Changes to notify>])
<Result>: Boolean
  • True if file watching is enabled,
  • False otherwise. To get more details on the error, use ErrorInfo.
<File to watch>: Character string
Full name of the file to be watched.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called when a change is made to the specified file.
For more details on this procedure, see Parameters of the procedure used by fWatchFile.
<Changes to notify>: Optional Integer constant (or combination of constants)
Changes made to the watched file and for which the procedure is to be executed:
fwAllAll actions are watched. Corresponds to fwCreateFile + fwModifyFile + fwRename + fwDeleteFile.
Before version 2024 Update 2, this constant was named ftAll.
fwCreateFileCreation of <File to watch>.
Before version 2024 Update 2, this constant was named ftCreateFile.
fwDeleteFileDeletion of <File to watch>.
Before version 2024 Update 2, this constant was named ftDeleteFile.
fwModifyFileModification of <File to watch>.
Before version 2024 Update 2, this constant was named ftModifyFile.
fwRenameRenaming of <File to watch>.
Before version 2024 Update 2, this constant was named ftRename.
Observaciones

Special cases

  • To stop watching the file, use fWatchStop and fWatchStopAll.
  • To watch changes made to the contents of a directory, use fWatchDirectory.
  • Limitations:
    • Only 5 files can be watched at the same time.
    • It is not possible to watch a file located at the root of a disk (for performance reasons).

WLanguage procedure

The WLanguage procedure is run in a WLanguage thread.
Please note: the following processes cannot be executed in threads:
  • opening windows with WLanguage functions such as Open, Use, Close, etc. A specific management mode must be implemented if some windows must be handled in threads (rare case). 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: 15/09/2024

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