// Watch the C:\WINDOWS directory for file creation and
// deletion.
dwChangeHandles[0] = FindFirstChangeNotification(
"d:\\chentob\\", // directory to watch
FALSE, // do not watch the subtree
FILE_NOTIFY_CHANGE_FILE_NAME); // watch file name changes
if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
ExitProcess(GetLastError());
// Watch the C:\ subtree for directory creation and
// deletion.
dwChangeHandles[1] = FindFirstChangeNotification(
"d:\\chentob\\chentob\\", // directory to watch
TRUE, // watch the subtree
FILE_NOTIFY_CHANGE_FILE_NAME); // watch dir. name changes
if (dwChangeHandles[1] == INVALID_HANDLE_VALUE)
ExitProcess(GetLastError());
// Change notification is set. Now wait on both notification
// handles and refresh accordingly.
// A file was created or deleted in C:\WINDOWS.
// Refresh this directory and restart the
// change notification. RefreshDirectory is an
// application-defined function.
//RefreshDirectory("C:\\WINDOWS")
dwWaitStatus=NULL;
if ( FindNextChangeNotification(
dwChangeHandles[0]))
// A directory was created or deleted in C:\.
// Refresh the directory tree and restart the
// change notification. RefreshTree is an
// application-defined function.
//RefreshTree("C:\\");
dwWaitStatus=NULL;
if (FindNextChangeNotification(
dwChangeHandles[1]))