Link to home
Start Free TrialLog in
Avatar of stephaneeybert
stephaneeybert

asked on

Reload a document to a previously saved state.

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.
ASKER CERTIFIED SOLUTION
Avatar of plaroche
plaroche

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stephaneeybert
stephaneeybert

ASKER

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.
May I ask what is the behavior? Have you placed a breakpoint in OnOpenDocument() does it get called?
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

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

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.