Solved

Reload a document to a previously saved state.

Posted on 1998-09-29
6
203 Views
Last Modified: 2013-11-20
I created a small program. It works fine, but when I reload an already loaded and modified document that has been previously saved, I don't get a warning saying that I'm about to loose the modifications of my document nor do I get the reloaded document. The loading does not occur.
But things work fine if I load another document.
0
Comment
Question by:stephaneeybert
  • 4
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 100 total points
ID: 1322691
The warning should come when the current document is about to be closed. To have that warning you have to indicate that the document has been modified via the SetModifiedFlag(TRUE).

If your application is SDI OnNewDocument won't be called again when opening another document, OnOpenDocument will be. If you are doing something in OnNewDocument then it'll only be done once, that may explain your problem of the second document not being loaded.
0
 

Author Comment

by:stephaneeybert
ID: 1322692
Dear plaroche, I'm already using the function SetModifiedFlag(). My program is a SDI. This function allows me to get a warning when I attempt to close a document that has been modified since its last save. It also gives me a warning when I attempt to load another document if the current document has been modified since its last save. But it does not give me a warning when I attempt to reload the same document if the current document has been modified since its last save. The program Notepad does this fine. My program would not reload an already loaded and modified document. My program should not only reload the current document, but also should give me a warning that I'm loading an old version of the document. I hope you see the problem now.
Thanks for your answer anyway.
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1322693
May I ask what is the behavior? Have you placed a breakpoint in OnOpenDocument() does it get called?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:stephaneeybert
ID: 1322694
I did not override OnOpenDocument.
The behavior of my program is that when I try to reload an already loaded and even modified document, the document is not reloaded. Therefore I did not think overriding OnOpenDocument was the answer to the problem. But then again, I might be wrong.
I propose you to email me directly if you wish to, at stephane_eybert@prqa.co.uk

0
 

Author Comment

by:stephaneeybert
ID: 1322695
I did not override OnOpenDocument.
The behavior of my program is that when I try to reload an already loaded and even modified document, the document is not reloaded. Therefore I did not think overriding OnOpenDocument was the answer to the problem. But then again, I might be wrong.
I propose you to email me directly if you wish to, at stephane_eybert@prqa.co.uk

0
 

Author Comment

by:stephaneeybert
ID: 1322696
Dear Plaroche, I read in the book Inside Visual C++ that MFC does not handle the functionality I am asking for. I don't know why such a basic capability is not taken care of by MFC. A solution to this well known problem (cf D. Kruklingski Inside Visual C++) should exist somewhere.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 94
sumNumber challenge 16 139
has22 challenge 11 105
Annoying "thing" blocks my view 4 115
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question