|
|
|
|
|
- Special cases
- WLanguage procedure
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.
sNomFichier is string = "C:\Temp\MonRep\MonFichier.extension"
IF fWatchFile(sNomFichier, fSurveilleFichier_Callback, ...
fwCreateFile + fwModifyFile + fwDeleteFile + ...
fwRename) THEN
Info("La mise sous surveillance du fichier " + sNomFichier + " a réussi.")
ELSE
Info("La mise sous surveillance du fichier " + sNomFichier + " a échoué.")
END
INTERNAL PROCEDURE fSurveilleFichier_Callback(sNomComplet, sNomFichierSurveille, nAction, sAncienNomFichier)
sDesignationAction is string
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
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. <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: | | fwAll | All actions are watched. Corresponds to fwCreateFile + fwModifyFile + fwRename + fwDeleteFile. Before version 2024 Update 2, this constant was named ftAll. | fwCreateFile | Creation of <File to watch>. Before version 2024 Update 2, this constant was named ftCreateFile. | fwDeleteFile | Deletion of <File to watch>. Before version 2024 Update 2, this constant was named ftDeleteFile. | fwModifyFile | Modification of <File to watch>. Before version 2024 Update 2, this constant was named ftModifyFile. | fwRename | Renaming 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.
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|