Article View: borland.public.cppbuilder.nativeapi
Article #10033Re: Using Damon Chandler's FindNextChangeNotification example
From: JD
Date: Sat, 22 May 2004 17:29
Date: Sat, 22 May 2004 17:29
29 lines
1910 bytes
1910 bytes
"Timothy H. Buchman" <tbuchmanREMOVE(at)PLEASEcitycenter D O To r g> wrote:
>> else TForm::WndProc(Message);
>
> [...] don't you want the default handling to always take place
> after you do your processing? The code above could leave the
> message hanging around.
>
> ShowMessage("A File was changed");
> }
> TForm::WndProc(Message);
I don't think it makes any difference if the 'else' is there
or not. If I don't pass it onto the base class handler, the
message is swallowed and if I do pass it on, nothing will
happen because the base class handler has no concept of the
message.
By adding a static counter to the monitoring thread, I was
able to confirm that a single change to the directory was
correctly detected but when the thread called the
FindNextChangeNotification, that same change was detected
again as a new change.
I fixed it by reworking the logic so that I don't use FindNext
any more. Instead I FindClose and then FindFirst again. Not as
efficient I know but it does get the job done.
~ JD
Technical Details
Message-ID:
<40af8def$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40ade94f$1@newsgroups.borland.com> <40af63b7$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.139.241.46 References: <40ade94f$1@newsgroups.borland.com> <40af63b7$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <40af8def$1@newsgroups.borland.com> Date: 22 May 2004 10:29:19 -0700 X-Trace: newsgroups.borland.com 1085246959 207.105.83.66 (22 May 2004 10:29:19 -0700) Lines: 30 Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail