Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with serialization

Help with serialization

Scheduled Pinned Locked Moved C / C++ / MFC
c++comsysadmindockerdebugging
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Juan Carlos Cobas
    wrote on last edited by
    #1

    Hi, I have a full server/container MFC app. I'm trying to serialize the embeded OLE objects in an independent file (e.g. I don't want my document file to save the ole objects, I want them in a separate one). This is what I'm doing: //SAVE OLE OBJECTS CFile fil( "test.ole", CFile::modeWrite | CFile::modeCreate ); CArchive ar( &fil, CArchive::store ); COleServerDoc::Serialize(ar); (...) //LOAD OLE OBJECTS TRY { CFile fil( "test.ole", CFile::modeRead ); CArchive ar( &fil, CArchive::load ); COleServerDoc::Serialize(ar); } CATCH( CFileException, e ) { (...) } END_CATCH It seems that the file was properly saved, but when I try to load it, I get a debug assertion when COleServerDoc::Serialize(ar) is called. What am I doing wrong? Thanks,

    J 1 Reply Last reply
    0
    • J Juan Carlos Cobas

      Hi, I have a full server/container MFC app. I'm trying to serialize the embeded OLE objects in an independent file (e.g. I don't want my document file to save the ole objects, I want them in a separate one). This is what I'm doing: //SAVE OLE OBJECTS CFile fil( "test.ole", CFile::modeWrite | CFile::modeCreate ); CArchive ar( &fil, CArchive::store ); COleServerDoc::Serialize(ar); (...) //LOAD OLE OBJECTS TRY { CFile fil( "test.ole", CFile::modeRead ); CArchive ar( &fil, CArchive::load ); COleServerDoc::Serialize(ar); } CATCH( CFileException, e ) { (...) } END_CATCH It seems that the file was properly saved, but when I try to load it, I get a debug assertion when COleServerDoc::Serialize(ar) is called. What am I doing wrong? Thanks,

      J Offline
      J Offline
      Juan Carlos Cobas
      wrote on last edited by
      #2

      I fix it, these two lines did the trick: m_bCompoundFile = false; ar.m_pDocument = (COleDocument*)this;

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups