CObList Serialization in MFC Extension DLL
Posted on 1997-09-09
Environment: Visual C++5.0 WinNT 4.0
I am trying to serialize a CObList in a similar manner to the Microsoft drawcli sample. The main differences are my code resides in an MFC extension DLL, while there code is in an EXE. Also their document is based on a COleDocument and mine is based on a standard CDocument.
I have included the implement serial and declare serial macros in the class and its CPP file. The object list is defined as:
typedef CTypedPtrList<CObList, AZDRAWANNO*> CDrawObjList;
The problem I have is that dispite the fact that the serialize function in each of my objects is called the data is in some way corrupt because it will not reload; I get the error: "Unexpected File Format". In the CObList::Serialize code I have noticed that the number of objects is not initialized when attempting to load, although is correct when attempting to save.
I have also noticed that when I debug the Microsoft example the pNode object created in CObList::Serialize is defined as a CDrawRect *and* includes a node in the variables window labelled CDrawRect (allowing the data that is to be stored to be seen). When I debug my code the pNode object is defined as CDrawRect, but the CDrawRect node is missing.