

- #How to turn on autosave in word 2000 how to
- #How to turn on autosave in word 2000 install
- #How to turn on autosave in word 2000 code
- #How to turn on autosave in word 2000 windows
GetDocument()->StoreAutoRecoveryInformation(fname) M_autosave_names.push_back(fname) // add the new filename to the vector // call store function M_autosave_names.erase(m_autosave_names.begin()) remove the old filename from the vector an error has occured, process the error here if you want // however, if the file simply does not exist, // that is fine, ignore the error and continue

If(CFF.FindFile((*m_autosave_names.begin()))=TRUE) If(m_autosave_names.size() > 0) // delete old file document name and your autosave extension an error has occured, process the error here If(CreateDirectory(gm_autosaveDirectory.GetBuffer( 1), If(CFF.FindFile(gm_autosaveDirectory.GetBuffer( 1))=FALSE)
#How to turn on autosave in word 2000 code
Additionally, your program must make sure that the directory for your autosave has been created before saving to it! If an error occurs during the process, the choice is up to you how you will recover or handle it.Ĭopy Code void CMyView::OnAutosaveTimer(WPARAM w, LPARAM l)

This implementation uses a vector of CStrings to store the backup filenames (this vector will contain either the name of the backup or nothing at all). Since the autosave name is based off the actual filename (in case the user needs to manually access the file in some strange incident) and you don't want more than one copy of the autosaved file, your program must always store the name of the last autosave backup and delete the autosaved backup, before it writes its copy of the file. The problem is that if the user saves the file in another location, then the restore path for the file will change also. ON_MESSAGE(WM_MYVIEW_AUTOSAVETIMER,OnAutosaveTimer)Īnd prototype the function in your view's class definition as a void accepting the standard WPARAM and LPARAM messages. Use EnumChildWindows to call a procedure with each child window. Within this function, you will need to send autosave messages to all the views contained by your app. The OnTimer() function of your Main Frame will now be called each time the timer has expired.
#How to turn on autosave in word 2000 install
SetTimer(0,m_autosavetime * 60 * 1000,NULL) will install the timer for you (assuming m_autosavetime is in minutes). On initialization, your program needs to call the SetTimer(.) function with the appropriate values. To avoid soaking up system resources, use the OnTimer function in your Main Frame window. The next part is, therefore, implementing the save routine in your application. Now that the path is determined, your program will know where to save its files. However, the above implementation will allow you to specify a specific directory for the files to occupy, such as "Temporary Autosaved Files". Optionally, you could use GetTempPath(DWORD nBufferLength, LPTSTR lpBuffer) to retrieve a temporary path. ::GetEnvironmentVariable( " WINDIR",buffer, 512) It is best preformed within the InitInstance function of your application. The following code will do just that ( gm_autosave directory should be a string, either global, as with this example, or accessible through a member function in your application). You can easily check to see if the stored directory exists, by using the CFileFind class to search for it. If for some reason, the user's system does not contain a WINDIR environment variable, or the environment variable is incorrectly set, your program needs to detect this and choose another directory. This directory should be stored in the environment variable WINDIR.

#How to turn on autosave in word 2000 windows
For practical purposes, your program should place them inside a folder in the most constant directory on the HD, the Windows directory. This directory must remain constant, or else you would have to search the entire hard disk for autosaved files. Assigning an Autosave Directoryįirst, you must choose where you are going to save the files. If any are found, it will then begin its recovery process. Each time the program loads up, it must search for autosaved files and restore them as needed.Īs with Office, this implementation saves these temporary files to a temporary directory inside your Windows directory and searches this directory at load time for autosaved files. These serializations must not overwrite the files that are currently in use by the user, because this would eliminate the user's choice of whether or not they would like to save the file on exit from your program. After a specific amount of time, your program must serialize the loaded documents to the disk at a specific location.
#How to turn on autosave in word 2000 how to
This article will describe how to implement an autosave and autorecover method similar to that used by MS Office. How to autosave files and then recover these files after a program crashes, is something that is seldom discussed, but adds power and flexibility to a program.
