 |
| Monitoring changes occurring within a directory |
User rating: 0/10 (0 votes) | |
|
|
 |
 |
Versions: click to open |
 |
|
 |
 |
| Before you begin: |
 |
To stop the following code after it has been started, open and save any file in C:\TEMP directory.
See also:
FileSystemWatcher ActiveX Control for Visual FoxPro
Monitoring changes in a directory
Enumerating files opened on the network
|
 |
 |
| |
| |
Members area. Log in to view this example. |
|
| |
|
|
|
|
|
 |
User rating: 0/10 (0 votes) | |
| 1841 bytes Created: 2003-05-09 09:16:21 Modified: 2011-02-16 13:28:54 Visits in 7 days: 85 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
To stop the following code after it has been started, open and save any file in C:\TEMP directory.
* * *
The C++ sample displays file and directory changes for drive C in a console window. Close the window when you no longer need it.
This code itself makes an interesting tool. Download C++ project, compile and start the executable. Then open VFP or IE window, or even move the mouse above the Windows taskbar -- you will see how many files and directory modifications may hide behind such a simple action.
* * *
Deleting a directory with subdirectories into the Recycle Bin produces a single FILE_NOTIFY_INFORMATION structure with the directory data. While a direct delete (the Recycle Bin is bypassed) triggers ReadDirectoryChangesW for each subdirectory, and finally for the directory.
* * *
When designing a file monitoring utility (FLL or ActiveX control), it should be considered that VFP creates single threaded applications.
While busy with processing directory changes, an application is unable to receive other changes coming. Frequent changes and substantial processing time make such miss unavoidable.
Thus a VFP application must receive not the actual directory changes, but rather be notified when they occur. Notifications may come through window messages or by events raised.
A monitoring utility must take care of piling changes in its own memory, and dispatching them to a client application upon request. |
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|