Solved

Reload a document to a previously saved state.

Posted on 1998-09-29
6
200 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now