LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get an event notification when a file is changed ?

Dear,
 

I have to do something on a file or folder when this is changed from outside the program. I can write a loop and look regularly to the change date. However to avoid unnecessary CPU processing, I would like to be notified when a file is changed. Can this be done by events in LabVIEW ?

 

Thanks in advance for your reaction.

 

Best regards,

Marc

0 Kudos
Message 1 of 4
(3,397 Views)
On Windows, if you can find an activex control that can generate an event for your file change then you can make an event handler in LabVIEW for it. This can set off a user event or a notifier, thereby bringing the file system event into the LabVIEW dataflow. Most people just poll the file for a change.
0 Kudos
Message 2 of 4
(3,389 Views)

Thank you for the response.

Which Active-X control and function do I have to use?
 
Best regards,
Marc
0 Kudos
Message 3 of 4
(3,372 Views)


@Marc VH wrote:
Dear,
 

I have to do something on a file or folder when this is changed from outside the program. I can write a loop and look regularly to the change date. However to avoid unnecessary CPU processing, I would like to be notified when a file is changed. Can this be done by events in LabVIEW ?



LabVIEW has not a build in disk event handler. On Windows I would call the Windows API functions FindFirstChangeNotification together with the according event handling APIs. Or maybe since LabVIEW does not run on 9x systems anyhow anymore use ReadDirectoryChangesW instead.

Enclosed is a simple example using FindFirstChangeNotification. It is all enclosed in one VI using an internal shift register. This limits the function to be used for on change notification at the same time only. In order to make it deal with multiple change notifications one would have to change quite a bit of the VI, possibly taking out the create, retrigger and close operation into individual VIs passing an uInt32 between them for the change notification handle.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 4
(3,349 Views)