Click here to Skip to main content
12,456,128 members (54,202 online)
Rate this:
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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2016
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