Re: CDocument and Schemas
CDocument is not serialized like your objects. The framework calls
CDocument::Serialize instead of CArchive::WriteObject/ReadObject, so even if
you add IMPLEMENT_SERIAL to your class, a file header won't be added. If MFC
adds a file header to every document, MFC won't be able to support text, rtf
or other file formats.
Instead, YOU are responsible for encoding schema numbers, images, sounds or
whatever you care enough to save to your document. If you want to add a
version number to your document, well, since CDocument itself does not have
any data, extract your document's serializable part to another class and add
a version number to it.
--
Sheng Jiang
Microsoft MVP in VC++
"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:upSZAKcvHHA.4688@TK2MSFTNGP04.phx.gbl...
Well, I've been searching for an hour and I cannot find an answer to this.
When serializing data, I'd like to specify a schema so that older files
will
not completely crash newer versions of the programs. All I can find is
that
I should use IMPLEMENT_SERIAL.
However, CDocument and the document class created by MFC does not use
IMPLEMENT_SERIAL!!! It uses IMPLEMENT_DYNCREATE, which does not take a
schema argument.
I obviously don't recall how I'm supposed to set the schema for a
CDocument-derived class, but why can't I find ANYTHING on this?!?!?!
Thanks.
Jonathan