Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Change Notification Event

Status
Not open for further replies.

CajunCenturion

Programmer
Joined
Mar 4, 2002
Messages
11,381
Location
US
I know there is such an event, and that it has been discussed in this forum, but I can't find the thread, nor can I seem to find the object which owns that event. Could someone please help by posting the thread id, or by identifying the parent object of that event.

Thank you.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Here's a couple of methods:

SHChangeNotify from Shell32, sadly not exposed by the Microsoft Shell Controls and Automation library so you have to do it the hard way.

Both FindFirstChangeNotification and ReadDirectoryChangesW will allow you to spot changes to an entire volume. However, FindFirstChangeNotification will then merely tell you that a change occurred, not which file it occurred to. ReadDirectoryChangesW, on the other hand, can return the filename of the changed file (of course, depending on program requirements, this may not be an important distinction). I know a put an example on using this API call in Thread222-576673 and I'm sure there are others.
 
Thank you strongm. I knew that you had addressed this before, but I was unable to coax the search engine into finding the right thread.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I couldn't find my previous posts on the subject either
 
Just in case you were interested in the task, I have an Access database (not by choice, but the political considerations have closed that discussion) where the functional requirement is in reality a Record Insert Trigger on one particular table. There are multiple applications in play.

What I'm hoping that I can do is create a separate mdb file with just that one table, which now an autonumber field for my exclusive use, and link to that from the main mdb. Then place a watch on the mdb file with the single table, and upon notification, use the autonumber to determine if the file update was the result of a record insert (don't care about record updates), and if so, take care of business, on that and all newly inserted records as I can foresee, although small, where multiple inserts can be so close together that I can't assume that one message means only one new record.

Obviously, the key element is that when one of the other application performs a record insert, that the OS will detect the file change and trigger the event to let my app do what it needs to do.

I'll let you know with any luck sometime on Monday.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top