Monitors a directory for file changes in a seperate thread.
FindFileChange(cDirectory, bWatchSubtree, nFilter, cCallback)
Parameters
- cDirectory
The full path of the directory to be watched. This cannot be a relative path or an empty string.
The name is limited to MAX_PATH (260) characters.
- bWatchSubtree
If this parameter is .T., the function monitors the directory tree rooted at the specified directory; if it is .F., it monitors only the specified directory.
- nFilter
The filter conditions that satisfy a change notification. This parameter can be one or more of the following values.
Value Meaning FILE_NOTIFY_CHANGE_FILE_NAME Any file name change in the watched directory or subtree causes a change notification wait operation to return. Changes include renaming, creating, or deleting a file name. FILE_NOTIFY_CHANGE_DIR_NAME Any directory-name change in the watched directory or subtree causes a change notification wait operation to return. Changes include creating or deleting a directory. FILE_NOTIFY_CHANGE_ATTRIBUTES Any attribute change in the watched directory or subtree causes a change notification wait operation to return. FILE_NOTIFY_CHANGE_SIZE Any file-size change in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change in file size only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed. FILE_NOTIFY_CHANGE_LAST_WRITE Any change to the last write-time of files in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change to the last write-time only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed. FILE_NOTIFY_CHANGE_SECURITY Any security-descriptor change in the watched directory or subtree causes a change notification wait oper
- cCallback
The function to call when one of the filter conditions occur in the monitored directory or subtree.
The function should have to following signature:FUNCTION FolderChanged LPARAMETERS hHandle, cPath, nError IF nError = 0 ? cPath + ' changed' ELSE ? 'Function: ' + cPath + " failed. ErrorNo. ", nError ENDIF ENDFUNC
Return Value
A numeric handle representing the thread which monitors the directory.
See Also
Reference
ADirectoryInfo
ADirEx
ADriveInfo
AFileAttributes
AFileAttributesEx
CancelFileChange
CompareFileTimes
CopyFileEx
DeleteDirectory
DeleteFileEx
GetFileAttributes
GetFileOwner
GetFileSize
GetFileTimes
GetLongPathName
GetShortPathName
MoveFileEx
SetFileAttributes
SetFileTimes
Used WinApi functions
FindFirstChangeNotification
FindNextChangeNotification
CreateThread
WaitForMultipleObjects
PostMessage