![]() |
【转帖】problem about ole object read111
problem about ole object read!!!
problem about ole object read!!! hi, i use the following code to read oddbole2frame object, but it didn't work. when runs to "coleclientitem::serialize(carchive& ar)", the program get the coleclientitem's type flag is not "ot_ole2", then throw an exception. why? are there some error in my code? ////////////////////////////////////////////////// class file : public cfile { odstreambuf& m_stream; public: file(odstreambuf& stream) : m_stream(stream) { m_strfilename = "oddbole2frame binary data."; m_bcloseondelete = false; } uint read(void* lpbuf, uint ncount) { oduint32 nbytesleft = m_stream.length()-m_stream.tell(); if(nbytesleft < ncount) ncount = nbytesleft; m_stream.getbytes(lpbuf, ncount); return ncount; } void write(const void* lpbuf, uint ncount) { m_stream.putbytes(lpbuf, ncount); } }; void load(oddbole2frame* pframe, coleclientitem* pitem) { odmemorystreamptr pbuff = odmemorystream::createnew(); (pframe->itemhandler())->getcompounddocument(*pbuff.get()); pbuff->rewind(); file file(*pbuff.get()); carchive archive(&file, carchive::load); pitem->serialize(archive); } /////////////////////////////////////// btw, when i use oddbole2frame::getitemhandler() to replace oddbole2frame::itemhandler() to get odoleitemhandler*, the program always throw the exception, why? |
所有的时间均为北京时间。 现在的时间是 11:10 PM. |