Can I get changes to file information in a specified directory using FindFirstChangeNotification and FindNextChangeNofication instead of ReadDirectoryChangesW?
I want to be notified when a specified directory has any changes in its files or subdirectories. I am implementing a function with the following simple code segment:
UINT myThreadFunc(LPVOID pParam)
{
int changeCount = 0;
while(true)
{
HANDLE changeHandle = FindFirstChangeNotification(L"C:\\", TRUE, FILE_NOTIFY_CHANGE_FILE_NAME);
WaitForSingleObject(changeHandle, INFINITE);
cout<<"A modifaction has occured"<<endl;
changeCount++;
if (changeCount >= 10)
break;
if ( FindNextChangeNotification( changeHandle ) == FALSE )
break;
}
bIsExit = TRUE;
return 0;
}
How can I get information like action type or filename without using ReadDirectoryChangesW
?
+1
source to share
1 answer
MSDN status:
This function does not indicate changes that met the pending condition. Use the ReadDirectoryChangesW function to get information about specific changes within a notification (check the link text )
+1
source to share