Change Notification

Juergen Hasch Hasch at t-online.de
Mon Jan 13 22:56:04 GMT 2003


Below is my test program, nothing special:

/* test change notification */
#include <windows.h>
#include <stdio.h>

int main()
{
DWORD dwWaitStatus;
HANDLE dwChangeHandles[1];


dwChangeHandles[0] = FindFirstChangeNotification(
    "i:\\TEST",                 // directory to watch
    FALSE,                         // do not watch the subtree
    FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes


if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
    exit(GetLastError());

printf("Starting change notification\n");
// Change notification is set. Now wait on both notification
// handles and refresh accordingly.

    while (TRUE) {
        dwWaitStatus = WaitForMultipleObjects(1, dwChangeHandles,
            FALSE, INFINITE);

        printf(".");
        switch (dwWaitStatus) {
            case WAIT_OBJECT_0:
                if (FindNextChangeNotification( dwChangeHandles[0]) == 
FALSE )
                    exit(GetLastError());
                break;
            default:
                printf( "Change notify failure\n");
                exit(0);
                break;
        }
    }
    return 0;
}

I can't tell you if the change I made to reply.c completely solves my 
problem , I'll need to test this at work.
But what I found out would explain the effects I had.

...Juergen





More information about the samba-technical mailing list