|
Hi,
The assertion was in ..\OLEDOC1.CPP in
CDocItem::Serialize(CArchive& ar) function in line 816. The problem was that
ar.m_pDocument was NULL.
I fixed with by simply attaching my document to the
CArchive object:
ar.m_pDocument =
(COleDocument*)this;
I had also to set
CDocument::m_bCompound to false. It seems that everything works fine now
:-)
I have another question though:
Is it possible to use a CMemFile to serialize the
OLE objects into memory? What I'd like to do is to serialize the objects
to the memory and then perform some operations (e.g. write the memory contents
in another file, in this case in an XML file encoded in Base64). This is what
I'm trying:
CMemFile mf;
CArchive ar( &mf, CArchive::store ); COleServerDoc::Serialize(ar); mf.SeekToBegin(); int nSize = mf.GetLength(); BYTE* pBuffer = mf.Detach(); CString csBase64; csBase64 = CMarkup::EncodeBase64( pBuffer, nSize); xml.AddChildElem("Values", csBase64); ar.Close(); This asserts when the memory file object (mf) gets
out of scope or when ar.Close() is called. The assertion is in
CMemFile::AssertValid(), exactly in the following line:
ASSERT(m_nFileSize <=
m_nBufferSize);
Any idea?
Thanks,
Carlos
----- Original Message -----
|
- [msvc] Problem with serialization Juan Carlos Cobas
- Re: [msvc] Problem with serialization Juan Carlos Cobas
- RE: [msvc] Problem with serialization Ehsan Akhgari
- Re: [msvc] Problem with serialization Juan Carlos Cobas
- RE: [msvc] Problem with serialization Juan Carlos Cobas
- RE: [msvc] Problem with serialization Jason Teagle
- Re: [msvc] Problem with serialization Juan Carlos
- [msvc] C++ test [OT] Juan Carlos
- RE: [msvc] C++ test [OT] Ehsan Akhgari
