Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to detect a file update
Message
From
17/06/2008 12:38:47
 
 
To
17/06/2008 12:19:31
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01324776
Message ID:
01324810
Views:
34
I just tested the sample that ships with VFP9:
Tools->Task Pane->Solution Samples->New in VFP9->Binding to Windows Message events
Select File/Folder Shell Events and click Enable Events. Choose to monitor all locations.
Now if you change any file, you will see the change in the window as "Updated file/directory:....". I only tried a few minutes, and I agree that I could not see which file was changed, but I believe you can modify the code to give you that info also. If not, as long as you can see that something has in deed happened, a simple adir() plus a few more lines will tell you which file has been updated.



>I'd love to know how. Any suggestions? When I use my modified sample, it shows file deletion info and file creation info, but when I open the file in Notepad and type something and save and close the file, no message is displayed.
>
>Unless the sample app is throwing away those messages and only showing file create/delete?
>
>Gary
>
>>That's not correct, you can also monitor changes to a file.
>>
>>>Hi Naomi,
>>>Thanks for the reply. What I want to do is monitor a file and know when it's being written to. I've played with the VFP API sample
>>>that uses bindevent, but it only registers file creation/deletion not updates.
>>>
>>>I'm hoping there is an argument to look at file update events as well as creation/deletion. I tried both substituting and adding SHCNE_UPDATEITEM to the example's WM_USER_SHNOTIFY, but I have no idea what might be the correct arg or combination.
>>>
>>>Gary
>>>
>>>>>Hi all,
>>>>>
>>>>>I'm trying to figure out how to detect an update in a text file. I want to monitor updates to a log file from a 3rd party application. I looked at the VFP 9 sample and tweaked it to point at a specific file easily enough, but it only reports file deletion/creation, not updates to the file. Does anyone know how to intercept a file update?
>>>>>
>>>>>Thanks.
>>>>>
>>>>>Gary
>>>>
>>>>Not sure, if this is helpful, but check Re: Send signals to each user using same system Thread #1293566
Previous
Reply
Map
View

Click here to load this message in the networking platform