Solved

Reload a document to a previously saved state.

Posted on 1998-09-29
6
199 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
Comment Utility
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
Comment Utility
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
Comment Utility
May I ask what is the behavior? Have you placed a breakpoint in OnOpenDocument() does it get called?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:stephaneeybert
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

763 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

7 Experts available now in Live!

Get 1:1 Help Now