• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            小步慢跑

             

            richedit 打開包含 ole 對象 的大文件出現“內存不足”

            起因是我在ocx中封裝了一個 richedit2.0 控件,并自己寫了一個 用于顯示圖片 ole 對象 。在我的ocx中插入大量的ole對象,大約3000個,然后保存為rtf。再使用我的ocx控件打開這個rtf時,會提示 內存不足。跟蹤代碼時發現在我實現的  IRichEditOleCallback 接口的 GetNewStorage(LPSTORAGE* lplpstg) 中報錯。

            我的程序中創建 IStorage的思路是,在   IRichEditOleCallback 接口初始化時調用 StgCreateDocfile 創建一個根 Istorage,以后每個對象插入的時候   IRichEditOleCallback 的  GetNewStorage 接口被調用,在 GetNewStorage 方法中 在   根 Istorage 下建立一個subStroage。 



            HRESULT hResult = ::StgCreateDocfile(NULL,STGM_TRANSACTED|STGM_READWRITE | STGM_SHARE_EXCLUSIVE |STGM_CREATE ,
            0, &m_pStorage );


            //建立一個sub storage

            WCHAR tName[50] = {0};
             swprintf(tName, L"substorage%d", m_iNumStorages);

            HRESULT hResult = pStorage->CreateStorage(tName,
            STGM_TRANSACTED|STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE ,
            0, 0, lplpstg );


            后來發現 把  STGM_TRANSACTED 標識去掉就可以了。有點莫名其妙,估計是事務的處理會導致內存的占用增加的緣故吧。

            另外 在msdn 中 搜索 STGM ,注意紅色的字體,也就是收 使用com中的 IStorage 接口,是不能創建具有  STGM_TRANSACTED 表示的 IStream對象的 

            STGM_TRANSACTED
            In transacted mode, changes are buffered and written only if an explicit commit operation is called. To ignore the changes, call the Revert method in the IStream, IStorage, or IPropertyStorage interface. The COM compound file implementation of IStorage does not support transacted streams, which means that streams can be opened only in direct mode, and you cannot revert changes to them, however transacted storages are supported. The compound file, stand-alone, and NTFS file system implementations of IPropertySetStorage similarly do not support transacted, simple property sets because these property sets are stored in streams. However, transactioning of nonsimple property sets, which can be created by specifying the PROPSETFLAG_NONSIMPLE flag in the grfFlags parameter of IPropertySetStorage::Create, are supported.

            posted on 2012-07-13 09:43 zaccheo 閱讀(1249) 評論(0)  編輯 收藏 引用

            導航

            統計

            常用鏈接

            留言簿

            隨筆分類(23)

            隨筆檔案(26)

            文章分類(1)

            文章檔案(1)

            csdn

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            日产精品久久久一区二区| 久久久久久无码Av成人影院| 狠狠久久亚洲欧美专区| 青草影院天堂男人久久| 国产亚州精品女人久久久久久 | 久久免费精品一区二区| 精品久久久久国产免费| 久久久久av无码免费网| 99久久99久久精品国产| 久久人妻少妇嫩草AV蜜桃| 久久本道伊人久久| 久久精品国产亚洲AV忘忧草18| 久久99精品久久久久久hb无码| 久久国产精品二国产精品| 久久久久久亚洲AV无码专区| 日韩中文久久| 91久久精品国产成人久久| 婷婷综合久久中文字幕蜜桃三电影| 88久久精品无码一区二区毛片| 欧美牲交A欧牲交aⅴ久久| 久久久久亚洲AV成人网人人网站| 久久99精品久久久久久久不卡 | 亚洲国产成人精品91久久久| 国产精品乱码久久久久久软件| 好久久免费视频高清| 狠狠色丁香婷婷久久综合五月| 欧美久久综合性欧美| 久久久无码精品亚洲日韩按摩| 久久无码精品一区二区三区| 四虎国产永久免费久久| 99久久超碰中文字幕伊人| 亚洲女久久久噜噜噜熟女| 伊人色综合九久久天天蜜桃| 久久精品国产福利国产琪琪| 狠狠色噜噜狠狠狠狠狠色综合久久| 性色欲网站人妻丰满中文久久不卡| 久久人人爽人人爽人人爽| 思思久久好好热精品国产 | 久久精品国产99久久久古代| 久久国产亚洲精品| 狠狠精品久久久无码中文字幕|