亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? iperstor.cpp

?? 英文版的 想要的話可以下載了 為大家服務(wù)
?? CPP
字號:
/*
 * IPERSTOR.CPP
 * Cosmo Chapter 21
 *
 * Implementation of the IPersistStorage interface that we expose on
 * the CFigure compound document object.  This ties into the
 * functionality of CPolyline.
 *
 * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
 *
 * Kraig Brockschmidt, Microsoft
 * Internet  :  kraigb@microsoft.com
 * Compuserve:  >INTERNET:kraigb@microsoft.com
 */


#include "cosmo.h"


/*
 * CImpIPersistStorage:CImpIPersistStorage
 * CImpIPersistStorage::~CImpIPersistStorage
 *
 * Constructor Parameters:
 *  pObj            PCFigure associated with this object.
 *  pUnkOuter       LPUNKNOWN of the controlling unknown.
 */

CImpIPersistStorage::CImpIPersistStorage(PCFigure pObj
    , LPUNKNOWN pUnkOuter)
    {
    m_cRef=0;
    m_pObj=pObj;
    m_pUnkOuter=pUnkOuter;
    m_psState=PSSTATE_UNINIT;

    m_fConvert=FALSE;
    return;
    }


CImpIPersistStorage::~CImpIPersistStorage(void)
    {
    return;
    }




/*
 * CImpIPersistStorage::QueryInterface
 * CImpIPersistStorage::AddRef
 * CImpIPersistStorage::Release
 */

STDMETHODIMP CImpIPersistStorage::QueryInterface(REFIID riid
    , PPVOID ppv)
    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

STDMETHODIMP_(ULONG) CImpIPersistStorage::AddRef(void)
    {
    ++m_cRef;
    return m_pUnkOuter->AddRef();
    }

STDMETHODIMP_(ULONG) CImpIPersistStorage::Release(void)
    {
    --m_cRef;
    return m_pUnkOuter->Release();
    }





/*
 * CImpIPersistStorage::GetClassID
 *
 * Purpose:
 *  Returns the CLSID of the object represented by this interface.
 *
 * Parameters:
 *  pClsID          LPCLSID in which to store our CLSID.
 *
 * Return Value:
 *  HRESULT         NOERROR or a general error value.
 */

STDMETHODIMP CImpIPersistStorage::GetClassID(LPCLSID pClsID)
    {
    if (PSSTATE_UNINIT==m_psState)
        return ResultFromScode(E_UNEXPECTED);

    *pClsID=m_pObj->m_clsID;
    return NOERROR;
    }





/*
 * CImpIPersistStorage::IsDirty
 *
 * Purpose:
 *  Tells the caller if we have made changes to this object since
 *  it was loaded or initialized new.
 *
 * Parameters:
 *  None
 *
 * Return Value:
 *  HRESULT         Contains S_OK if we ARE dirty, S_FALSE if
 *                  NOT dirty.
 */

STDMETHODIMP CImpIPersistStorage::IsDirty(void)
    {
    if (PSSTATE_UNINIT==m_psState)
        return ResultFromScode(E_UNEXPECTED);

    //CFigure::FIsDirty returns the document's dirty flag.
    return ResultFromScode(m_pObj->FIsDirty() ? S_OK : S_FALSE);
    }







/*
 * CImpIPersistStorage::InitNew
 *
 * Purpose:
 *  Provides the object with the IStorage to hold on to while the
 *  object is running.  Here we initialize the structure of the
 *  storage and AddRef it for incremental access. This function will
 *  only be called once in the object's lifetime in lieu of Load.
 *
 * Parameters:
 *  pIStorage       LPSTORAGE for the object.
 *
 * Return Value:
 *  HRESULT         NOERROR or a general error value.
 */

STDMETHODIMP CImpIPersistStorage::InitNew(LPSTORAGE pIStorage)
    {
    HRESULT     hr;

    if (PSSTATE_UNINIT!=m_psState)
        return ResultFromScode(E_UNEXPECTED);

    if (NULL==pIStorage)
        return ResultFromScode(E_POINTER);

    /*
     * The rules of IPersistStorage mean we hold onto the IStorage
     * and pre-create anything we'd need in Save(...,TRUE) for
     * low-memory situations.  For us this means creating our
     * "CONTENTS" stream and holding onto that IStream as
     * well as the IStorage here (requiring an AddRef call).
     */

    hr=pIStorage->CreateStream(SZSTREAM, STGM_DIRECT
        | STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE
        , 0, 0, &m_pObj->m_pIStream);

    if (FAILED(hr))
        return hr;

    //We expect that the client has called WriteClassStg
    WriteFmtUserTypeStg(pIStorage, m_pObj->m_cf
        , (*m_pObj->m_pST)[IDS_USERTYPE]);

    pIStorage->AddRef();
    m_pObj->m_pIStorage=pIStorage;

    m_psState=PSSTATE_SCRIBBLE;
    return NOERROR;
    }





/*
 * CImpIPersistStorage::Load
 *
 * Purpose:
 *  Instructs the object to load itself from a previously saved
 *  IStorage that was handled by Save in another object lifetime.
 *  This function will only be called once in the object's lifetime
 *  in lieu of InitNew. The object should hold on to pIStorage here
 *  for incremental access and low-memory saves in Save.
 *
 * Parameters:
 *  pIStorage       LPSTORAGE from which to load.
 *
 * Return Value:
 *  HRESULT         NOERROR or a general error value.
 */

STDMETHODIMP CImpIPersistStorage::Load(LPSTORAGE pIStorage)
    {
    HRESULT     hr;
    LONG        lRet;
    LPSTREAM    pIStream;

    if (PSSTATE_UNINIT!=m_psState)
        return ResultFromScode(E_UNEXPECTED);

    if (NULL==pIStorage)
        return ResultFromScode(E_POINTER);

    //This tells us if we're coming from another class storage.
    m_fConvert=(NOERROR==GetConvertStg(pIStorage));

    //This is the type of storage we're really messing with in Treat As
    ReadClassStg(pIStorage, &m_pObj->m_clsID);

    hr=pIStorage->OpenStream(SZSTREAM, 0, STGM_DIRECT
        | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pIStream);

    //We might be looking for OLE 1 streams as well.
    if (FAILED(hr))
        {
        hr=pIStorage->OpenStream(SZOLE1STREAM, 0, STGM_DIRECT
            | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pIStream);

        if (FAILED(hr))
            return ResultFromScode(STG_E_READFAULT);

        m_pObj->m_pPL->m_fReadFromOLE10=TRUE;
        }

    if (FAILED(hr))
        return ResultFromScode(STG_E_READFAULT);

    lRet=m_pObj->m_pPL->ReadFromStream(pIStream);

    if (lRet < 0)
        return ResultFromScode(STG_E_READFAULT);


    /*
     * We don't call pIStream->Release here because we may need
     * it for a low-memory save in Save.  We also need to
     * hold onto a copy of pIStorage, meaning AddRef.
     */
    m_pObj->m_pIStream=pIStream;

    pIStorage->AddRef();
    m_pObj->m_pIStorage=pIStorage;

    m_psState=PSSTATE_SCRIBBLE;
    return NOERROR;
    }





/*
 * CImpIPersistStorage::Save
 *
 * Purpose:
 * Purpose:
 *  Saves the data for this object to an IStorage which may
 *  or may not be the same as the one previously passed to
 *  Load, indicated with fSameAsLoad.  After this call we may
 *  not write into the storage again until SaveCompleted is
 *  called, although we may still read.
 *
 * Parameters:
 *  pIStorage       LPSTORAGE in which to save our data.
 *  fSameAsLoad     BOOL indicating if this is the same pIStorage
 *                  that was passed to Load.  If TRUE, then the
 *                  object should write whatever it has *without
 *                  *using any extra memory* as this may be a low
 *                  memory save attempt.  That means that you must
 *                  not try to open or create streams.  If FALSE
 *                  you need to regenerate your whole storage
 *                  structure, being sure to also release any
 *                  pointers held from InitNew and Load.
 *
 * Return Value:
 *  HRESULT         NOERROR or a general error value.
 */

STDMETHODIMP CImpIPersistStorage::Save(LPSTORAGE pIStorage
    , BOOL fSameAsLoad)
    {
    LONG        lRet;
    HRESULT     hr;
    LPSTREAM    pIStream;
    LONG        lVer=VERSIONCURRENT;

    //Have to come here from scribble state.
    if (PSSTATE_SCRIBBLE!=m_psState)
        return ResultFromScode(E_UNEXPECTED);

    //Must have an IStorage if we're not in SameAsLoad
    if (NULL==pIStorage && !fSameAsLoad)
        return ResultFromScode(E_POINTER);

    /*
     * If this was read from an OLE 1.0 storage, but there is no
     * convert bit, then we have to save the 1.0 format to the
     * "\1Ole10Native" stream.  Otherwise if we were converting
     * from OLE 1.0, we should nuke the stream since it's no longer
     * useful.  To handle this, we call WriteToStorage with
     * VERSIONCURRENT in any convert case.  WriteToStorage will
     * remove the OLE 1.0 stream if it previously read from one, or
     * it will just save normally.
     *
     * The Polyine allows us to look at it's m_fReadFromOLE10 which
     * tells us to pass it 0x00010000 if we're not converting, that
     * is, we're doing Treat As on the OLE 1.0 object and so we
     * need to write the new data in the Ole10Native stream.
     */

    if (!m_fConvert && m_pObj->m_pPL->m_fReadFromOLE10)
        lVer=0x00010000;


    /*
     * If we're saving to a new storage, create a new stream.
     * If fSameAsLoad it TRUE, then we write to the
     * stream we already allocated.  We should NOT depends on
     * pIStorage with fSameAsLoad is TRUE.
     *
     * If we're converting an OLE 1 storage to an OLE 2 storage,
     * then we have to create a new stream (conversion is not
     * guaranteed to succeed in low memory) and delete the old
     * one, so we ignore fSameAsLoad if we're converting.
     */

    if (fSameAsLoad
        && !(m_pObj->m_pPL->m_fReadFromOLE10 && m_fConvert))
        {
        LARGE_INTEGER   li;

        /*
         * Use pre-allocated streams to avoid failures due
         * to low-memory conditions.  Be sure to reset the
         * stream pointer if you used this stream before!!
         */
        pIStream=m_pObj->m_pIStream;
        LISet32(li, 0);
        pIStream->Seek(li, STREAM_SEEK_SET, NULL);

        //This matches the Release below.
        pIStream->AddRef();
        }
    else
        {
        hr=pIStorage->CreateStream(SZSTREAM, STGM_DIRECT
            | STGM_CREATE | STGM_WRITE | STGM_SHARE_EXCLUSIVE
            , 0, 0, &pIStream);

        if (FAILED(hr))
            return hr;

        WriteFmtUserTypeStg(pIStorage, m_pObj->m_cf
            , (*m_pObj->m_pST)[IDS_USERTYPE]);
        }

    lRet=m_pObj->m_pPL->WriteToStream(pIStream, lVer);
    pIStream->Release();

    /*
     * If we are overwriting an OLE 1 storage, delete the old
     * Ole10Native stream if writing our CONTENTS worked.
     */
    if (m_pObj->m_pPL->m_fReadFromOLE10 && m_fConvert && (lRet >= 0))
        pIStorage->DestroyElement(SZOLE1STREAM);

    //Clear the convert bit if it was set
    if (m_fConvert)
        {
        UINT        cf;

        cf=RegisterClipboardFormat((*m_pObj->m_pST)[IDS_FORMAT]);
        WriteFmtUserTypeStg(pIStorage, cf
            , (*m_pObj->m_pST)[IDS_USERTYPE]);

        SetConvertStg(pIStorage, FALSE);
        m_fConvert=FALSE;
        }

    if (lRet >= 0)
        {
        m_psState=PSSTATE_ZOMBIE;
        return NOERROR;
        }

    return ResultFromScode(STG_E_WRITEFAULT);
    }






/*
 * CImpIPersistStorage::SaveCompleted
 *
 * Purpose:
 *  Notifies the object that the storage in pIStorage has been
 *  completely saved now.  This is called when the user of this
 *  object wants to save us in a completely new storage, and if
 *  we normally hang on to the storage we have to reinitialize
 *  ourselves here for this new one that is now complete.
 *
 * Parameters:
 *  pIStorage       LPSTORAGE of the new storage in which we live.
 *
 * Return Value:
 *  HRESULT         NOERROR or a general error value.
 */

STDMETHODIMP CImpIPersistStorage::SaveCompleted(LPSTORAGE pIStorage)
    {
    HRESULT     hr;
    LPSTREAM    pIStream;

    //Must be called in no-scribble or hands-off state
    if (!(PSSTATE_ZOMBIE==m_psState || PSSTATE_HANDSOFF==m_psState))
        return ResultFromScode(E_UNEXPECTED);

    //If we're coming from Hands-Off, we'd better get a storage
    if (NULL==pIStorage && PSSTATE_HANDSOFF==m_psState)
        return ResultFromScode(E_UNEXPECTED);

    /*
     * If pIStorage is NULL, then we don't need to do anything
     * since we already have all the pointers we need for Save.
     * Otherwise we have to release any held pointers and
     * reinitialize them from pIStorage.
     */

    if (NULL!=pIStorage)
        {
        hr=pIStorage->OpenStream(SZSTREAM, 0, STGM_DIRECT
            | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0
            , &pIStream);

        if (FAILED(hr))
            return hr;

        if (NULL!=m_pObj->m_pIStream)
            m_pObj->m_pIStream->Release();

        m_pObj->m_pIStream=pIStream;

        if (NULL!=m_pObj->m_pIStorage)
            m_pObj->m_pIStorage->Release();

        m_pObj->m_pIStorage=pIStorage;
        m_pObj->m_pIStorage->AddRef();
        }

    m_pObj->SendAdvise(OBJECTCODE_SAVED);
    m_psState=PSSTATE_SCRIBBLE;
    return NOERROR;
    }





/*
 * CImpIPersistStorage::HandsOffStorage
 *
 * Purpose:
 * Purpose:
 *  Instructs the object that another agent is interested in having
 *  total access to the storage we might be hanging on to from
 *  InitNew or SaveCompleted.  In this case we must release our hold
 *  and await another call to SaveCompleted before we have a hold
 *  again.  Therefore we cannot read or write after this call until
 *  SaveCompleted.
 *
 *  Situations where this might happen arise in compound document
 *  scenarios where this object might be in-place active but the
 *  application wants to rename and commit the root storage.
 *  Therefore we are asked to close our hold, let the container
 *  party on the storage, then call us again later to tell us the
 *  new storage we can hold.
 *
 * Parameters:
 *  None
 *
 * Return Value:
 *  HRESULT         NOERROR or a general error value.
 */

STDMETHODIMP CImpIPersistStorage::HandsOffStorage(void)
    {
    /*
     * Must come from scribble or no-scribble.  A repeated call
     * to HandsOffStorage is an unexpected error (bug in client).
     */
    if (PSSTATE_UNINIT==m_psState || PSSTATE_HANDSOFF==m_psState)
        return ResultFromScode(E_UNEXPECTED);

    //Release held pointers
    if (NULL!=m_pObj->m_pIStream)
        {
        m_pObj->m_pIStream->Release();
        m_pObj->m_pIStream=NULL;
        }

    if (NULL!=m_pObj->m_pIStorage)
        {
        m_pObj->m_pIStorage->Release();
        m_pObj->m_pIStorage=NULL;
        }

    m_psState=PSSTATE_HANDSOFF;
    return NOERROR;
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久精品| 国产一二三精品| 欧美mv日韩mv| 天天色天天操综合| 亚洲欧美另类久久久精品2019| 精品99久久久久久| 欧美高清一级片在线| 91首页免费视频| 波多野结衣在线一区| 国产高清不卡二三区| 久久精品99国产精品日本| 五月综合激情婷婷六月色窝| 夜夜亚洲天天久久| 亚洲一区二区三区影院| 中文字幕亚洲一区二区av在线 | caoporen国产精品视频| 懂色av一区二区在线播放| 国产另类ts人妖一区二区| 久久国产精品99精品国产| 国产乱子轮精品视频| 国产精品一卡二卡| 国产成人8x视频一区二区| 国产成人精品三级麻豆| 成人av免费在线观看| 91丝袜国产在线播放| 欧美视频在线一区二区三区| 欧洲亚洲精品在线| 欧美精品丝袜久久久中文字幕| 欧美精品 国产精品| 欧美一区二区三区免费观看视频| 日韩美一区二区三区| 久久精品国产在热久久| 免费观看在线综合色| 国产一区二区久久| 午夜欧美电影在线观看| 一区二区免费看| 久久99国产精品成人| 97久久超碰国产精品| 在线精品视频免费播放| 欧美一级一区二区| 亚洲欧美日韩久久| 久久激情综合网| 94色蜜桃网一区二区三区| 欧美区一区二区三区| 中文字幕不卡在线| 日韩激情在线观看| av在线播放一区二区三区| 日韩精品最新网址| 一区二区三区加勒比av| 国产成人精品影视| 欧美一区在线视频| 亚洲一区二区三区四区不卡| 国产福利精品一区| 日韩精品最新网址| 奇米色一区二区| 欧美日韩国产美女| 亚洲综合激情网| 91麻豆国产自产在线观看| 欧美国产精品一区二区三区| 精品一区二区在线看| 欧美一区二区大片| 亚洲成人一区在线| 欧美日韩1区2区| 亚洲网友自拍偷拍| 欧美影视一区在线| 亚洲成av人在线观看| 欧美三级日本三级少妇99| 亚洲精品乱码久久久久久日本蜜臀| 国产精一品亚洲二区在线视频| 5566中文字幕一区二区电影| 亚洲精品免费看| 欧美视频在线观看一区二区| 香蕉成人伊视频在线观看| 欧美日本在线一区| 免费国产亚洲视频| 国产日韩欧美精品一区| 成人午夜在线免费| 亚洲另类色综合网站| 欧美唯美清纯偷拍| 开心九九激情九九欧美日韩精美视频电影 | 国产精品久久久一本精品| 99国产精品久久久久| 青青青伊人色综合久久| 国产性色一区二区| 一本久久精品一区二区| 天天色天天爱天天射综合| 日韩欧美在线1卡| av在线不卡免费看| 蜜臀av性久久久久蜜臀aⅴ流畅 | 久久久精品国产免大香伊| eeuss影院一区二区三区| 一二三四社区欧美黄| 精品国产一区二区三区av性色| 国产黄人亚洲片| 亚洲一二三四区不卡| 久久综合给合久久狠狠狠97色69| 91亚洲精品久久久蜜桃网站| 亚洲一级在线观看| 亚洲国产精品v| 精品欧美乱码久久久久久1区2区| 97aⅴ精品视频一二三区| 久久99精品国产麻豆婷婷洗澡| 欧美国产精品一区| 欧美xxx久久| 欧美猛男gaygay网站| 91在线你懂得| 成人av网站免费| 国产老妇另类xxxxx| 日韩av在线发布| 亚洲高清免费在线| 亚洲欧美日韩国产另类专区 | 精品一区二区三区久久久| 亚洲一区中文在线| 一区二区三区在线免费视频 | 一区二区中文视频| 日本一区二区三区在线观看| xf在线a精品一区二区视频网站| 欧美视频一区二区在线观看| 在线观看免费一区| 欧美午夜不卡在线观看免费| 日本丰满少妇一区二区三区| 91在线国产福利| 在线观看区一区二| 在线不卡一区二区| 2021国产精品久久精品| 久久精品在这里| 国产精品美女久久久久久2018 | 精品制服美女丁香| 国产一区91精品张津瑜| 不卡的av在线播放| 欧美系列一区二区| 精品黑人一区二区三区久久| 国产亚洲成av人在线观看导航| 亚洲国产电影在线观看| 樱花影视一区二区| 美国毛片一区二区| 成人av一区二区三区| 欧美在线观看视频一区二区 | 欧美久久婷婷综合色| 欧美成人性福生活免费看| 综合欧美亚洲日本| 日韩一区欧美二区| 成人黄色小视频| 欧美乱妇20p| 亚洲欧洲精品一区二区三区| 亚洲v精品v日韩v欧美v专区| 国产91丝袜在线播放0| 欧美日韩激情在线| 中文字幕日韩av资源站| 首页国产丝袜综合| 免费的成人av| 波多野结衣视频一区| 日韩精品一区二| 亚洲一区二区三区四区在线观看| 激情综合网天天干| 在线精品视频一区二区三四| 国产亚洲精品免费| 麻豆精品精品国产自在97香蕉| 93久久精品日日躁夜夜躁欧美| 精品国产乱码久久久久久久| 亚洲一区二区三区四区在线免费观看 | 久国产精品韩国三级视频| 欧洲精品视频在线观看| 久久久久一区二区三区四区| 蜜臀久久久久久久| 在线播放日韩导航| 亚洲不卡一区二区三区| 欧美日本不卡视频| 亚洲va国产天堂va久久en| 日本高清视频一区二区| 国产精品乱码妇女bbbb| 成人黄页在线观看| 国产精品乱码妇女bbbb| 99久久精品免费看| 尤物在线观看一区| 欧美日韩美少妇| 老司机免费视频一区二区三区| 欧美区一区二区三区| 捆绑调教美女网站视频一区| 欧美岛国在线观看| 不卡一区在线观看| 一区二区理论电影在线观看| 欧美日韩免费在线视频| 奇米色一区二区| 中文字幕精品在线不卡| 欧美亚日韩国产aⅴ精品中极品| 亚洲综合免费观看高清完整版 | 国产欧美日韩在线视频| 99久久er热在这里只有精品15| 18欧美乱大交hd1984| 婷婷亚洲久悠悠色悠在线播放| 精品在线你懂的| 久久久亚洲精品一区二区三区| 成人精品免费看| 亚洲国产乱码最新视频| 国产亚洲欧美激情| 在线不卡中文字幕| 不卡一区中文字幕| 九九热在线视频观看这里只有精品| 国产女人18毛片水真多成人如厕 |