Re: Back up of modified files
Code:
#define _WIN32_WINNT 0x400
1) Comment out that line in whichever file you put it (stdafx.h ?)
2) Put the same line right at the top of any source file that calls ReadDirectoryChangesW().
3) Save both files.
4) Re-compile the module that now contains the above #define (don't re-compile the whole project - just that one source file).
Do you still get the same error?
Re: Back up of modified files
Re: Back up of modified files
Can you zip up that module (and its header file) and post them here as an attachment?
Re: Back up of modified files
Quote:
Originally Posted by erankushmehta
I am using Windows 2000 Professional.
One other question - what version of Visual C++ are you using?
1 Attachment(s)
Re: Back up of modified files
I am using VC++ 6.0.
Actually i am trying to use a wrapper class whose source code i have taken from the following link.
http://www.codeproject.com/file/dire...ngewatcher.asp
I have yet to add my code.
Anyway, just take the attachement as well.
Re: Back up of modified files
Quote:
Originally Posted by erankushmehta
Please Help..I have attached the code above..
Re: Back up of modified files
Quote:
Originally Posted by erankushmehta
Code:
if(!ReadDirectoryChangesW( pdi->m_hDir,
pdi->m_Buffer,//<--FILE_NOTIFY_INFORMATION records are put into this buffer
READ_DIR_CHANGE_BUFFER_SIZE,
pdi->m_bWatchSubDir,
pdi->m_dwChangeFilter,
&pdi->m_dwBufLength,//this var not set when using asynchronous mechanisms...
&pdi->m_Overlapped,
NULL))
i am getting following error:
I am using Windows 2000 Professional.
Help....Plz..
Re: Back up of modified files
1 Attachment(s)
Re: Back up of modified files
The only obvious thing I could see was that you hadn't included the line that I suggested:-
Code:
#define _WIN32_WINNT 0x400
As soon as I did that, the 'undeclared identifier' error went away.
Anyway, I've revised your program to make better use of Wes Jones's Directory Change Watcher. If you run the attached app, it will start watching the folder C:\Program Files - then, after about 5 seconds, it will stop watching the folder. In both cases, a suitable message will be displayed in your console window.
Unfortunately, I didn't have time to figure out a way to get any changes notified (e.g. a file being added) since this would mean keeping the console open, without it being in a loop of some sort. Good luck with the rest of it... :wave:
Re: Back up of modified files
Thanks John..actually i tried the same..i wonder how couldn't i resolve the error(i must have done somthing really silly)...anyway thanks a lot dear.. :wave:
Re: Back up of modified files
Quote:
Originally Posted by ovidiucucu
Call
CopyFile to copy the original file in a new one before saving the modifications.
Well, upto now i have been able to get the names of files as soon as these are modified.
Now, i want to make different versions of the file each time it is modified.
I am following the approach below.Please guide is it the right way:
1) Suppose as soon as i open a.txt, its copy ~$a.txt is created.
2) If we close without saving ~$a.txt is deleted & original a.txt remains as such.
3) However, if we click save, a version of file, say a1, should be created. Next time, if save is clicked a2 should be created.
4) After the file is closed, a.txt should be deleted & ~$a.txt should be renamed to a.txt.
Having mentioned above 4 points, how can i get the notification that a file has been closed.
Kindly Guide.
Regards,
Ankush
Re: Back up of modified files
Upto now i have managed to get the filenames of modified files & create their copies with new names being formed after suffixing time in seconds to their original name.
i am watching a directory(say, C:\Temp) & making copies of modified files in the same directory.
The Problem: As soon as i make a copy of a modified file, this copy creates its own copy and the chain reaction is triggered.It seems addition of file to the directory( or making a copy) is considered as modification.Is it the case here?
1. Kindly Guide how to resolve this
2. Do i necessarily need to have a separate back up directory to avoid this conflict?(However, asper requirement i can't do this).