Click here to Skip to main content
11,805,035 members (63,207 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MFC

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
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
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:[^]
Rate this: bad
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

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

  Print Answers RSS
0 OriginalGriff 315
1 CPallini 210
2 Richard Deeming 200
3 Sergey Alexandrovich Kryukov 168
4 CHill60 150
0 OriginalGriff 3,255
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2015
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