Article View: borland.public.cppbuilder.nativeapi
Article #10038Re: Using Damon Chandler's FindNextChangeNotification example
From: JD
Date: Sun, 23 May 2004 14:58
Date: Sun, 23 May 2004 14:58
58 lines
3274 bytes
3274 bytes
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote: > >"JD" <nospam@nospam.com> wrote in message >news:40b0233e$1@newsgroups.borland.com... > >> FILE_NOTIFY_CHANGE_LAST_WRITE ); > >That will be triggered whenever a file has been written to. > Are you sure that a single file isn't simply being written > to over and over between calls to FindFirst/NextChangeNotification(), Yes. I tested it using two methods. The first was to add a dummy file to the folder that I opended with NotePad and I simply clicked File | Save. The other method was to use a button click where I changed the file's timestamp using FileSetDate. > or that multiple files are being modified at the same time? No (I used a non-networked system). > Part of the problem with the change notification system is > that there is no way to determine what file has actually > been changed and why. The folder has a reasonbly small number of files so I can take a snapshot of the file timestamps and compare them when I get notification so I know what file(s) have been changed. The 'why' part is something that I still need to work on. I'm thinking some kind of log file - which I need to implement any way. > That is why I suggest SHChangeNotifyRegister(), becaue it > does support those kinds of things. I'd sure like to use it but I have to support win98. > Since you bring it up, though - why are you using WaitForMultipleObjects() > anyway? You are not actually waiting on multiple objects to > begin with, so you should use WaitForSingleObject() instead. Well ... Damon had it setup that way. > I see nothing wrong with Damon's code. However, you have > not shown all of your own code, so I cannot compare the > two. Since you mentioned that you did make some changes, I > would have to suspect that you probably changed something > that you should't have. I'll have to go back to my testbed and rework it again. I want to get Damon's sample working correctly because my solution isn't perfect. When I tested the button click method and changed the date of 2 files, I only received one notification BUT ... my snapshot caught the change to both files. ~ JD
Technical Details
Message-ID:
<40b0bc09$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!prodigy.com!newsfeed.cwix.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40ade94f$1@newsgroups.borland.com> <40af63b7$1@newsgroups.borland.com> <40af8def$1@newsgroups.borland.com> <40afda3f$1@newsgroups.borland.com> <40b0233e$1@newsgroups.borland.com> <40b030d4$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,32a59cffbb6bea4a X-Google-Attributes: gid10cc67,public From: "JD" <nospam@nospam.com> Sender: "JD" <nospam@nospam.com> Reply-To: "JD" <nospam@nospam.com> Subject: Re: Using Damon Chandler's FindNextChangeNotification example Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 172.158.58.72 References: <40ade94f$1@newsgroups.borland.com> <40af63b7$1@newsgroups.borland.com> <40af8def$1@newsgroups.borland.com> <40afda3f$1@newsgroups.borland.com> <40b0233e$1@newsgroups.borland.com> <40b030d4$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <40b0bc09$1@newsgroups.borland.com> Date: 23 May 2004 07:58:17 -0700 X-Trace: newsgroups.borland.com 1085324297 207.105.83.66 (23 May 2004 07:58:17 -0700) Lines: 59 Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!prodigy.com!newsfeed.cwix.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail