Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC
Hello
 
I am developing an application in MFC, my application need to monitor all the directories in the system that which file has been renamed or deleted or created.And i have to a make a log of all this things along with the path,time and name of the file.
 
I was looking in the net but i found most of the file watcher in C# but i need to develop in MFC,So kindly can any one guide me to complete this in MFC.
 
Thanks in Advance
Posted 11-Sep-12 22:33pm
Comments
Joan Murt at 12-Sep-12 4:49am
   
reposting won't help.
Improve your question, add details there and wait, if you are not getting the proper answer it can be due to some factors: bad written question, unclear or nobody knows hoe to solve it.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It can be done with WMI, so please go thru WMI with MFC.
 
The required query can be formulated as :
 
SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance ISA "CIM_DirectoryContainsFile" and TargetInstance.GroupComponent= "Win32_Directory.Name='C:\\Test\\MyFolderToMonitor'"
 
Now you can use this to build WMI based File Change notification event.
 
May this too help you:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa390425(v=vs.85).aspx[^]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Have a look at Change Journals[^]. It's better than using FindFirstChangeNotification or ReadDirectoryChangesW.
 
Best regards
Espen Harlinn
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Schatak 394
1 OriginalGriff 300
2 Abhijit Ghosh (Subho) 125
3 Andreas Gieriet 120
4 _Amy 115
0 OriginalGriff 7,137
1 Sergey Alexandrovich Kryukov 5,628
2 Maciej Los 3,529
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100