15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Serialization of non compound document data

Ron Forrester -- Ron@OrCAD.com
Wednesday, April 02, 1997


Environment: VC++ 4.2b/5.0, NT 4.0 SP2, 95

We are moving a pure SDK application over into MFC. The files which this
application save/load are not subject to change, i.e. I cannot change
the on disk format (for compatibility reasons) of these files in any
way.

However, I would like to use the normal CDocument serialization
procedure, such that I can still be OLE embeddable, linkable, etc.

Assuming I have underlying library code which loads [DbLoad(...)]and
saves [DbSave(...)] these files, any ideas how I can hook into the
OnOpenDocument and Serialize code such that OLE things still work?

---
Ron Forrester         OrCAD, Inc.     R&D - Layout Group
ron@orcad.com      [Personal Email -- forresters@worldnet.att.net]




DFPav@aol.com
Thursday, April 03, 1997

In a message dated 97-04-03 04:51:14 EST, you write:

> Assuming I have underlying library code which loads [DbLoad(...)]and
>  saves [DbSave(...)] these files, any ideas how I can hook into the
>  OnOpenDocument and Serialize code such that OLE things still work?
>  
I am in the same boat at my job.  You need to override the OnOpenDocument,
OnSaveDocument, and OnNewDocument.  Also, you probably don't want to be able
to choose the from the list of disk files when you open the file.  So you
want to 
override the file open and file save as dialogs.  This is a pain because
CWinApp::DoPromptFileName is not virtual.  (IMHO, it should be) Luckily it is
only called from two functions.  One is a CWinApp::OnFIleOpen (message
handler) and the other is CDocument::DoSave, this one is not virtual (IMHO,
it should be) It is called by three functions, OnFileSave, OnFileSaveAs, and
SaveModified (all in CDocument)  These three are 2 message handlers and a
virtual. At last, the bleeding has ended.  The long and short of it is that I
have to override all of the functions mentioned above.  Some are overridden
just to call my version of a function that I think should be virtual anyway
so the implementation of those can be almost the same as the MFC code that is
supplied.  I suggest saetting some breakpoints and cruisng through the MFC
source code and seeing what actually happens with all of this.  It will help.
Dan




Become an MFC-L member | Вернуться в корень Архива |