<?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[FindFirstChangeNotification: doppeltes Signal]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe für einen Dienst nachfolgende Thread-Prozedur geschrieben. Mit WaitForMultipleObjects wartet sie auf 2 Ereignisse: auf ein Signal zum Beenden (HANDLE wird der Prozedur übergeben) und auf ein Signal bei Änderung eines Verzeichnisinhaltes, erzeugt durch FindFirstChangeNotification. Funktioniert soweit, außer daß bei Änderung des Verzeichnisinhaltes die while-Schleife immer 2x aufgerufen wird. Kann mir jemand die Ursache dafür nennen?</p>
<p>Danke im voraus. Rob'</p>
<pre><code class="language-cpp">void ThreadProcedure(unsigned int index, HANDLE killevent)
{
  char sourcedir[MAX_PATH];
  strcpy(sourcedir, &quot;C:\\test&quot;);

  HANDLE change = FindFirstChangeNotification(sourcedir, false,
            FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE);

  if (change == INVALID_HANDLE_VALUE) return;
  else
  {
    HANDLE events[2];
    events[0] = killevent; // Beenden des Service
    events[1] = change; // Signal bei Änderung des Verzeichnisses

    while (WaitForMultipleObjects(2, events, false, INFINITE) != WAIT_OBJECT_0)
    {
      DoSomething();

      FindNextChangeNotification(change); // nächste Änderung auch überwachen
    }

    FindCloseChangeNotification(change);
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/148276/findfirstchangenotification-doppeltes-signal</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 08:08:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148276.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 May 2006 21:50:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FindFirstChangeNotification: doppeltes Signal on Wed, 24 May 2006 21:50:14 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe für einen Dienst nachfolgende Thread-Prozedur geschrieben. Mit WaitForMultipleObjects wartet sie auf 2 Ereignisse: auf ein Signal zum Beenden (HANDLE wird der Prozedur übergeben) und auf ein Signal bei Änderung eines Verzeichnisinhaltes, erzeugt durch FindFirstChangeNotification. Funktioniert soweit, außer daß bei Änderung des Verzeichnisinhaltes die while-Schleife immer 2x aufgerufen wird. Kann mir jemand die Ursache dafür nennen?</p>
<p>Danke im voraus. Rob'</p>
<pre><code class="language-cpp">void ThreadProcedure(unsigned int index, HANDLE killevent)
{
  char sourcedir[MAX_PATH];
  strcpy(sourcedir, &quot;C:\\test&quot;);

  HANDLE change = FindFirstChangeNotification(sourcedir, false,
            FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE);

  if (change == INVALID_HANDLE_VALUE) return;
  else
  {
    HANDLE events[2];
    events[0] = killevent; // Beenden des Service
    events[1] = change; // Signal bei Änderung des Verzeichnisses

    while (WaitForMultipleObjects(2, events, false, INFINITE) != WAIT_OBJECT_0)
    {
      DoSomething();

      FindNextChangeNotification(change); // nächste Änderung auch überwachen
    }

    FindCloseChangeNotification(change);
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1064640</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1064640</guid><dc:creator><![CDATA[Rob&#x27;]]></dc:creator><pubDate>Wed, 24 May 2006 21:50:14 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstChangeNotification: doppeltes Signal on Thu, 25 May 2006 06:10:46 GMT]]></title><description><![CDATA[<p>Vermutlich werden im Verzeichnis 2 (oder mehr) Änderungen durchgeführt... das ist eigentlich normal. Für ein schreiben einer Datei gibt es mehrere Änderungs-Notifications.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1064687</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1064687</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 25 May 2006 06:10:46 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstChangeNotification: doppeltes Signal on Sat, 27 May 2006 16:20:43 GMT]]></title><description><![CDATA[<p>Danke für Deine Antwort.</p>
<p>Welche Änderungen sind das dann? Vermutlich keine, die man mit den Filterbedingungen weiter einschränken könnte?</p>
<p>Rob'</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1066221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1066221</guid><dc:creator><![CDATA[Rob&#x27;]]></dc:creator><pubDate>Sat, 27 May 2006 16:20:43 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstChangeNotification: doppeltes Signal on Sat, 27 May 2006 17:05:52 GMT]]></title><description><![CDATA[<p>Wenn z.B: zweimal &quot;WriteFile&quot; benutzt wird um eine Datei zu schreiben, *kann* es vorkommen, dass Du zwei Benachrichtigungen bekommst... das lässt sich somit nicht verhindern... (ausser mit Vista und Transactional-FS <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1066269</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1066269</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 27 May 2006 17:05:52 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstChangeNotification: doppeltes Signal on Sat, 27 May 2006 18:53:15 GMT]]></title><description><![CDATA[<p>Ich kopiere einfach mit dem Windows-Explorer eine Datei in das Verzeichnis, und bekomme das aber 2x signalisiert. Macht da evtl. der Explorer irgendeine Schweinerei?</p>
<p>Rob'</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1066348</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1066348</guid><dc:creator><![CDATA[Rob&#x27;]]></dc:creator><pubDate>Sat, 27 May 2006 18:53:15 GMT</pubDate></item></channel></rss>