Remarks
Set to NULL by default, this pointer to a CDocument can be set to anything the user of the CArchive instance wants. A common usage of this pointer is to convey additional information about the serialization process to all objects being serialized. This is achieved by initializing the pointer with the document (a CDocument-derived class) that is being serialized, in such a way that objects within the document can access the document if necessary. This pointer is also used by COleClientItem objects during serialization.
The framework sets m_pDocument to the document being serialized when a user issues a File Open or Save command. If you serialize an Object Linking and Embedding (OLE) container document for reasons other than File Open or Save, you must explicitly set m_pDocument. For example, you would do this when serializing a container document to the Clipboard.
Example
CFile myFile("myfile.dat", CFile::modeCreate | CFile::modeWrite);
CArchive ar(&myFile, CArchive::store);
// Serialize the document to the archive.
if (ar.m_pDocument != NULL)
ar.m_pDocument->Serialize(ar);
CArchive Overview | Class Members | Hierarchy Chart
See Also CDocument, COleClientItem