ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / External file functions / WLanguage procedures
  • Caution
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
WLanguage procedure called by fWatchDirectory
WLanguage procedure ("callback") called by fWatchDirectory when a change is made to the watched directory.
This can be a local, global, or internal.
Example
// Nom du répertoire à surveiller
sNomRepertoire is string = "C:\Temp\MonRep"
// La procédure fSurveilleRépertoire_Callback sera appelée 
// lorsqu'un fichier ou un répertoire contenu dans le répertoire "C:\Temp\MonRep" sera modifié.  
IF fWatchDirectory(sNomRepertoire, fSurveilleRépertoire_Callback, fwCreateFile + ...
		fwModifyFile + fwDeleteFile + fwRename) THEN
	// On informe l'utilisateur de la mise sous surveillance du répertoire
	Info("La mise sous surveillance du répertoire " + sNomRepertoire + " a réussi.")
ELSE
	// On informe l'utilisateur de l'échec de la mise sous surveillance du répertoire
	Info("La mise sous surveillance du répertoire " + sNomRepertoire + " a échoué.")
END
// Code de la procédure
PROCEDURE fSurveilleRépertoire_Callback(sNomRepertoire, sNomFichier, nAction, sAncienNomFichier)
ExecuteMainThread(AjoutTable, sNomRepertoire, sNomFichier, nAction, sAncienNomFichier)
// Procédure qui agit sur le thread principal
PROCEDURE AjoutTable(sNomRepertoire, sNomFichier, 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 la table TABLE_MODIFICATIONS
TableAddLine(TABLE_MODIFICATIONS, sNomRepertoire, sNomFichier, ...
		sDesignationAction, sAncienNomFichier)
Syntax
fWatchDirectory_Callback(<Name of the watched directory> , <Name of modified element> , <Action> , <Former name>)
<Name of the watched directory>: Character string
Full name of the watched directory.
<Name of modified element>: Character string
Name of the modified file or directory.
<Action>: Integer constant
Action performed:
fwCreateFileThe <Name of modified element> file or directory was created in <Directory>.
fwDeleteFileThe <Name of modified element> file or directory was deleted from <Directory>.
fwModifyFileThe <Name of modified element> file or directory was modified in <Directory>.
fwRenameThe <Name of modified element> file or directory was renamed in <Directory>.
<Former name>: Character string
Former name of the modified file or directory if they were renamed.
Remarks

Caution

This 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.
Business / UI classification: Neutral code
Component: wd300std.dll
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help