ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions / WLanguage procedures
  • Caution
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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
// 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 fwCreateFile: sActionDesignation = "Creating files"
	CASE fwDeleteFile: sActionDesignation = "Deleting files"
	CASE fwModifyFile: sActionDesignation = "Modifying files"
	CASE fwRename: sActionDesignation = "Renaming files"
END
// Add a line containing the information about the modification
// into the TABLE_MODIFICATIONS table
TableAddLine(TABLE_MODIFICATIONS, sDirectoryName, sFileName, , ...
		sActionDesignation, sOldFileName)
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.
Caution: The following processes cannot be run in the threads:
  • opening windows with WLanguage functions such as Open, Use, Close, ... 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.
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/25/2024

Send a report | Local help