<?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[Probleme mit Verzeichnis überwachen]]></title><description><![CDATA[<p>Hey @all,</p>
<p>ich habe hier folgendes Programm</p>
<pre><code class="language-cpp">#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x501
#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;winbase.h&gt;
void WatchDir()
{
	for(;;) {
	BOOL bResult;
	HANDLE hDir;
	BYTE Buf[10000];
	DWORD RetBytes;
	FILE_NOTIFY_INFORMATION *pInfo;
	DWORD i = 0;
	WCHAR FileName[1000];

	hDir = CreateFile(
		L&quot;C:\\OracleTest\\oracle\\flash_recovery_area\\WWGDCF\\BACKUPSET&quot;,
		FILE_LIST_DIRECTORY,
		FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
		NULL,
		OPEN_EXISTING,
		FILE_FLAG_BACKUP_SEMANTICS,
		NULL);

	bResult = ReadDirectoryChangesW(
		hDir,
		Buf,
		10000,
		TRUE,
			FILE_NOTIFY_CHANGE_FILE_NAME		// Löschen, Erstellen oder Umbenennen
										| FILE_NOTIFY_CHANGE_DIR_NAME		// Löschen oder Erstellen oder Umbenennen eines Verzeichnisses
										| FILE_NOTIFY_CHANGE_SIZE			// Größe ändert sich
										| FILE_NOTIFY_CHANGE_LAST_WRITE 	// Dateizeit Letzte Änderung
										| FILE_NOTIFY_CHANGE_ATTRIBUTES	// Attribute geändert
										| FILE_NOTIFY_CHANGE_LAST_ACCESS 	// Dateizeit Letzter Zugriff (auch Lesen)
										| FILE_NOTIFY_CHANGE_CREATION 	// Dateizeit Erstellungsdatum ändert sich
										| FILE_NOTIFY_CHANGE_SECURITY,
		&amp;RetBytes,
		NULL,
		NULL);

	for(;;) {
		pInfo = (FILE_NOTIFY_INFORMATION *)&amp;Buf[i];
		switch(pInfo-&gt;Action) {
		case FILE_ACTION_ADDED: wprintf(L&quot;file added: &quot;); break;
		case FILE_ACTION_REMOVED: wprintf(L&quot;file deleted: &quot;); break;
		case FILE_ACTION_MODIFIED: wprintf(L&quot;time stamp or attribute changed: &quot;); break; 
		case FILE_ACTION_RENAMED_OLD_NAME: wprintf(L&quot;file name changed - old name: &quot;); break;
		case FILE_ACTION_RENAMED_NEW_NAME: wprintf(L&quot;file name changed - new name: &quot;); break;
		default: wprintf(L&quot;unknown event: &quot;);
		}

		lstrcpyn(FileName, pInfo-&gt;FileName, pInfo-&gt;FileNameLength / sizeof(WCHAR) + 1);
		FileName[pInfo-&gt;FileNameLength / sizeof(WCHAR) + 1] = '\0';
		wprintf(L&quot;%s\n&quot;, FileName);

		if(pInfo-&gt;NextEntryOffset == 0) break;
		i += pInfo-&gt;NextEntryOffset;
	};

	CloseHandle(hDir);
}
}

int main() {
	WatchDir();
	return 0;
}
</code></pre>
<p>Mein Problem ist nun das ich nicht alleEvents abfange...<br />
Beispiel: Ich füge 15 Dateien hinzu (je 10 KB) von 01.dat bis 15.dat<br />
dann bekomme ich 15 file added Nachrichten.<br />
Beim löschen der 15 Dateien bekomme ich jedoch nur ca. 5 - 13 Meldungen... Woran liegt das?</p>
<p>Hier mal die Ausgabe:</p>
<pre><code>file added: 01.png
time stamp or attribute changed: 01.png
time stamp or attribute changed: 01.png
time stamp or attribute changed: 01.png
file added: 02.png
time stamp or attribute changed: 02.png
time stamp or attribute changed: 02.png
time stamp or attribute changed: 02.png
file added: 03.png
time stamp or attribute changed: 03.png
time stamp or attribute changed: 03.png
time stamp or attribute changed: 03.png
file added: 04.png
file added: 05.png
time stamp or attribute changed: 05.png
time stamp or attribute changed: 05.png
time stamp or attribute changed: 05.png
file added: 06.png
time stamp or attribute changed: 06.png
time stamp or attribute changed: 06.png
time stamp or attribute changed: 06.png
file added: 07.png
time stamp or attribute changed: 07.png
time stamp or attribute changed: 07.png
time stamp or attribute changed: 07.png
file added: 08.png
time stamp or attribute changed: 08.png
time stamp or attribute changed: 08.png
time stamp or attribute changed: 08.png
file added: 09.png
time stamp or attribute changed: 09.png
time stamp or attribute changed: 09.png
time stamp or attribute changed: 09.png
file added: 10.png
file added: 11.png
time stamp or attribute changed: 11.png
time stamp or attribute changed: 11.png
time stamp or attribute changed: 11.png
file added: 12.png
file added: 13.png
time stamp or attribute changed: 13.png
time stamp or attribute changed: 13.png
time stamp or attribute changed: 13.png
file added: 14.png
file added: 15.png
time stamp or attribute changed: 15.png
time stamp or attribute changed: 15.png
time stamp or attribute changed: 15.png
file deleted: 01.png
file deleted: 04.png
file deleted: 05.png
file deleted: 06.png
file deleted: 07.png
file deleted: 08.png
file deleted: 09.png
file deleted: 10.png
file deleted: 11.png
file deleted: 12.png
file deleted: 13.png
file deleted: 14.png
file deleted: 15.png
</code></pre>
<p>Hoffe mir kann jemand helfen...</p>
<p>Vielen Dank im Voraus</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/193059/probleme-mit-verzeichnis-überwachen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 18:46:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/193059.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Sep 2007 13:39:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit Verzeichnis überwachen on Fri, 21 Sep 2007 13:39:46 GMT]]></title><description><![CDATA[<p>Hey @all,</p>
<p>ich habe hier folgendes Programm</p>
<pre><code class="language-cpp">#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x501
#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;winbase.h&gt;
void WatchDir()
{
	for(;;) {
	BOOL bResult;
	HANDLE hDir;
	BYTE Buf[10000];
	DWORD RetBytes;
	FILE_NOTIFY_INFORMATION *pInfo;
	DWORD i = 0;
	WCHAR FileName[1000];

	hDir = CreateFile(
		L&quot;C:\\OracleTest\\oracle\\flash_recovery_area\\WWGDCF\\BACKUPSET&quot;,
		FILE_LIST_DIRECTORY,
		FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
		NULL,
		OPEN_EXISTING,
		FILE_FLAG_BACKUP_SEMANTICS,
		NULL);

	bResult = ReadDirectoryChangesW(
		hDir,
		Buf,
		10000,
		TRUE,
			FILE_NOTIFY_CHANGE_FILE_NAME		// Löschen, Erstellen oder Umbenennen
										| FILE_NOTIFY_CHANGE_DIR_NAME		// Löschen oder Erstellen oder Umbenennen eines Verzeichnisses
										| FILE_NOTIFY_CHANGE_SIZE			// Größe ändert sich
										| FILE_NOTIFY_CHANGE_LAST_WRITE 	// Dateizeit Letzte Änderung
										| FILE_NOTIFY_CHANGE_ATTRIBUTES	// Attribute geändert
										| FILE_NOTIFY_CHANGE_LAST_ACCESS 	// Dateizeit Letzter Zugriff (auch Lesen)
										| FILE_NOTIFY_CHANGE_CREATION 	// Dateizeit Erstellungsdatum ändert sich
										| FILE_NOTIFY_CHANGE_SECURITY,
		&amp;RetBytes,
		NULL,
		NULL);

	for(;;) {
		pInfo = (FILE_NOTIFY_INFORMATION *)&amp;Buf[i];
		switch(pInfo-&gt;Action) {
		case FILE_ACTION_ADDED: wprintf(L&quot;file added: &quot;); break;
		case FILE_ACTION_REMOVED: wprintf(L&quot;file deleted: &quot;); break;
		case FILE_ACTION_MODIFIED: wprintf(L&quot;time stamp or attribute changed: &quot;); break; 
		case FILE_ACTION_RENAMED_OLD_NAME: wprintf(L&quot;file name changed - old name: &quot;); break;
		case FILE_ACTION_RENAMED_NEW_NAME: wprintf(L&quot;file name changed - new name: &quot;); break;
		default: wprintf(L&quot;unknown event: &quot;);
		}

		lstrcpyn(FileName, pInfo-&gt;FileName, pInfo-&gt;FileNameLength / sizeof(WCHAR) + 1);
		FileName[pInfo-&gt;FileNameLength / sizeof(WCHAR) + 1] = '\0';
		wprintf(L&quot;%s\n&quot;, FileName);

		if(pInfo-&gt;NextEntryOffset == 0) break;
		i += pInfo-&gt;NextEntryOffset;
	};

	CloseHandle(hDir);
}
}

int main() {
	WatchDir();
	return 0;
}
</code></pre>
<p>Mein Problem ist nun das ich nicht alleEvents abfange...<br />
Beispiel: Ich füge 15 Dateien hinzu (je 10 KB) von 01.dat bis 15.dat<br />
dann bekomme ich 15 file added Nachrichten.<br />
Beim löschen der 15 Dateien bekomme ich jedoch nur ca. 5 - 13 Meldungen... Woran liegt das?</p>
<p>Hier mal die Ausgabe:</p>
<pre><code>file added: 01.png
time stamp or attribute changed: 01.png
time stamp or attribute changed: 01.png
time stamp or attribute changed: 01.png
file added: 02.png
time stamp or attribute changed: 02.png
time stamp or attribute changed: 02.png
time stamp or attribute changed: 02.png
file added: 03.png
time stamp or attribute changed: 03.png
time stamp or attribute changed: 03.png
time stamp or attribute changed: 03.png
file added: 04.png
file added: 05.png
time stamp or attribute changed: 05.png
time stamp or attribute changed: 05.png
time stamp or attribute changed: 05.png
file added: 06.png
time stamp or attribute changed: 06.png
time stamp or attribute changed: 06.png
time stamp or attribute changed: 06.png
file added: 07.png
time stamp or attribute changed: 07.png
time stamp or attribute changed: 07.png
time stamp or attribute changed: 07.png
file added: 08.png
time stamp or attribute changed: 08.png
time stamp or attribute changed: 08.png
time stamp or attribute changed: 08.png
file added: 09.png
time stamp or attribute changed: 09.png
time stamp or attribute changed: 09.png
time stamp or attribute changed: 09.png
file added: 10.png
file added: 11.png
time stamp or attribute changed: 11.png
time stamp or attribute changed: 11.png
time stamp or attribute changed: 11.png
file added: 12.png
file added: 13.png
time stamp or attribute changed: 13.png
time stamp or attribute changed: 13.png
time stamp or attribute changed: 13.png
file added: 14.png
file added: 15.png
time stamp or attribute changed: 15.png
time stamp or attribute changed: 15.png
time stamp or attribute changed: 15.png
file deleted: 01.png
file deleted: 04.png
file deleted: 05.png
file deleted: 06.png
file deleted: 07.png
file deleted: 08.png
file deleted: 09.png
file deleted: 10.png
file deleted: 11.png
file deleted: 12.png
file deleted: 13.png
file deleted: 14.png
file deleted: 15.png
</code></pre>
<p>Hoffe mir kann jemand helfen...</p>
<p>Vielen Dank im Voraus</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1370162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1370162</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Fri, 21 Sep 2007 13:39:46 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Verzeichnis überwachen on Fri, 21 Sep 2007 16:22:45 GMT]]></title><description><![CDATA[<p>Rufe CreateFile () nur einmal <strong>vor</strong> Eintritt in die äussere for-Schleife auf. Ebenso CloseHandle () nur einmal erst <strong>nach</strong> Verlassen der äusseren for-Schleife.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1370245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1370245</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 21 Sep 2007 16:22:45 GMT</pubDate></item></channel></rss>