🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5220

Re: File Change Notification

#5220
From: JD
Date: Tue, 30 Aug 2005 12:47
30 lines
2085 bytes
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote:
>
> [...] Can you please check it on your machine?

I'll look at it as soon as I get a chance. In the mean time:

//-------------------------------------------------------------
void __fastcall TMonitorThread::Execute()
{
    HANDLE hFind = FindFirstChangeNotification(FPath.c_str(), false, FILE_NOTIFY_CHANGE_LAST_WRITE);
    if( hFind != INVALID_HANDLE_VALUE )
      {
          while( !Terminated )
            {
                switch( WaitForSingleObject(hFind, 500) )
                  {
                      case WAIT_OBJECT_0: PostMessage(Application->MainForm->Handle, CUSTOM_MESSAGE, 0, 0 );
                                          if( !FindNextChangeNotification(hFind) ) Terminate();
                                          break;
                      case  WAIT_TIMEOUT: break;
                      default           : Terminate();
                  }
            }
          FindCloseChangeNotification(hFind);
      }
}
//-------------------------------------------------------------

~ JD
Technical Details
Message-ID: <4314554d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43104b16$1@newsgroups.borland.com> <4310c4bf$1@newsgroups.borland.com> <43120094$1@newsgroups.borland.com> <43120b41@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7eb52702e05f5583
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: File Change Notification
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 205.188.116.198     
X-Forwarded-For: 172.130.221.228
References: <43104b16$1@newsgroups.borland.com> <4310c4bf$1@newsgroups.borland.com> <43120094$1@newsgroups.borland.com> <43120b41@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4314554d$1@newsgroups.borland.com>
Date: 30 Aug 2005 05:47:09 -0700
X-Trace: newsgroups.borland.com 1125406029 207.105.83.66 (30 Aug 2005 05:47:09 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail