<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[doppelte events bei FindFirst&#x2F;NextChangeNotification]]></title><description><![CDATA[<p>hola leute</p>
<p>fuer ne kleine synchronisation einer DBase datenbank hab ch mir nen thread gebastelt, der vom system ne benachrichtigung bekommen soll, wenn in einem bestimmten ordner eine datei beschrieben, geaendert oder ueberschrieben worden ist. funktioniert an sich tadellos. jedoch bekomme ich immer 2 events.</p>
<p>hier mal bissl code</p>
<pre><code class="language-cpp">void __fastcall WatchThread::Execute()
{
   Form1-&gt;events[1] = FindFirstChangeNotification(ExtractFilePath(Form1-&gt;Dateiname-&gt;Text).c_str(),
                                                  false, FILE_NOTIFY_CHANGE_LAST_WRITE);
   bool stop = false;
   unsigned int event_no = 0;
   Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Watch-Thread wurde gestartet&quot;);

   while(!stop)
   {
      event_no = WaitForMultipleObjects(2, Form1-&gt;events, false, INFINITE);

      switch(event_no)                         
      {
         case 0:
            stop = true;
            break;

         case 1:
            Sleep(500);
            ResetEvent(Form1-&gt;events[1]);
            Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Datei wurde veraendert&quot;);
            if(!FindNextChangeNotification(Form1-&gt;events[1]))
            {
               stop = true;
               Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Fehler: FindNextChangeNotification&quot;);
            }
            break;
      }
   }

   FindCloseChangeNotification(Form1-&gt;events[1]);
   Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Watch-Thread wurde beendet&quot;);
   delete this;
}
</code></pre>
<p>sobald ich die datei ueberschreibe oder so, bekomme ich</p>
<pre><code>Fehler: FindNextChangeNotofication
Fehler: FindNextChangeNotofication
</code></pre>
<p>als ausgabe in meinem memo. is das normal so ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/114483/doppelte-events-bei-findfirst-nextchangenotification</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 00:41:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/114483.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Jul 2005 18:23:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to doppelte events bei FindFirst&#x2F;NextChangeNotification on Mon, 04 Jul 2005 18:23:21 GMT]]></title><description><![CDATA[<p>hola leute</p>
<p>fuer ne kleine synchronisation einer DBase datenbank hab ch mir nen thread gebastelt, der vom system ne benachrichtigung bekommen soll, wenn in einem bestimmten ordner eine datei beschrieben, geaendert oder ueberschrieben worden ist. funktioniert an sich tadellos. jedoch bekomme ich immer 2 events.</p>
<p>hier mal bissl code</p>
<pre><code class="language-cpp">void __fastcall WatchThread::Execute()
{
   Form1-&gt;events[1] = FindFirstChangeNotification(ExtractFilePath(Form1-&gt;Dateiname-&gt;Text).c_str(),
                                                  false, FILE_NOTIFY_CHANGE_LAST_WRITE);
   bool stop = false;
   unsigned int event_no = 0;
   Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Watch-Thread wurde gestartet&quot;);

   while(!stop)
   {
      event_no = WaitForMultipleObjects(2, Form1-&gt;events, false, INFINITE);

      switch(event_no)                         
      {
         case 0:
            stop = true;
            break;

         case 1:
            Sleep(500);
            ResetEvent(Form1-&gt;events[1]);
            Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Datei wurde veraendert&quot;);
            if(!FindNextChangeNotification(Form1-&gt;events[1]))
            {
               stop = true;
               Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Fehler: FindNextChangeNotification&quot;);
            }
            break;
      }
   }

   FindCloseChangeNotification(Form1-&gt;events[1]);
   Form1-&gt;Memo1-&gt;Lines-&gt;Add(&quot;Watch-Thread wurde beendet&quot;);
   delete this;
}
</code></pre>
<p>sobald ich die datei ueberschreibe oder so, bekomme ich</p>
<pre><code>Fehler: FindNextChangeNotofication
Fehler: FindNextChangeNotofication
</code></pre>
<p>als ausgabe in meinem memo. is das normal so ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/823638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/823638</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Mon, 04 Jul 2005 18:23:21 GMT</pubDate></item></channel></rss>