SetDirectoryWatchEvent method

[method icon] SetDirectoryWatchEvent(dirname$, watchtree, flags, param)

>SetDirectoryWatchEvent

SetDirectoryWatchEvent

The SetDirectoryWatchEvent(DirName, WatchTree, Flags, Param) sets a watch on a directory's contents causing a DirectoryWatchEvent to be raised when a change occurs. If WatchTree is TRUE then all subdirectories are also watched. Flags should be set to one or more values from the FILE_NOTIFY_ENUM enumeration to watch for specific events. Param is a user-defined value that will be returned in the DirectoryWatchEvent.

The Flags parameter in the DirectoryWatchEvent event will be one of the values from the FILE_ACTION_ENUM enumeration.

OBJECT Client = CREATE "ClientCOM", "KClient", DEFEVENT ClientEvents
DEFEVENT ClientEvents.DirectoryWatchEvent(Path$, FileName$, Flags, Param)
	// Call handler function passed in Param
	'SYM(*Param)(Path$, FileName$, Flags)
END EVENT
DEFSUB 'Handler(Path$, FileName$, flags)
	// Handle changes
END SUB
// Set up watch. Pass handler function as Param
Client.SetDirectoryWatchEvent(Directory$, TRUE, _FILE_NOTIFY_CHANGE_FILE_NAME, SYM('Handler))
// Stop watching directory
Client.ClearDirectoryWatchEvent(Directory$)
See also:

BrandSplash, CameraCapture, ClearDirectoryWatchEvent, CreateBookMark, DisplayScreen, EmptyClientCache, EnableUserPreferences, EnableWarnings, FireServiceEvent, ForceDefaultFont, ForceReadableTextMode, FTPGet, FTPPut, GetForms, GetServiceAttribute, GetServiceCookie, GetSpecialFolderPath, HTTPGet, OpenServiceWindow, PlaySoundFile, SetCharacterEncoding, SetDefaultIMEMode, SetPrinterFontName, SetPrinterFontSize, SetPrinterPort, SetServiceAttribute, SetServiceCaption, SetServiceConnection, SetServiceCookie, SetServiceUrl, SetThrottle, ShowSIP