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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? iperstor.cpp

?? 英文版的 想要的話可以下載了 為大家服務
?? CPP
字號:
/*
 * IPERSTOR.CPP
 * Polyline Component Chapter 21
 *
 * Implementation of the IPersistStorage interface exposed on the
 * Polyline object.
 *
 * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
 *
 * Kraig Brockschmidt, Microsoft
 * Internet  :  kraigb@microsoft.com
 * Compuserve:  >INTERNET:kraigb@microsoft.com
 */


#include "polyline.h"


/*
 * CImpIPersistStorage:CImpIPersistStorage
 * CImpIPersistStorage::~CImpIPersistStorage
 *
 * Constructor Parameters:
 *  pObj            PCPolyline pointing to the object we live in.
 *  pUnkOuter       LPUNKNOWN of the controlling unknown.
 */

CImpIPersistStorage::CImpIPersistStorage(PCPolyline pObj
    , LPUNKNOWN pUnkOuter)
    {
    m_cRef=0;
    m_pObj=pObj;
    m_pUnkOuter=pUnkOuter;
    m_psState=PSSTATE_UNINIT;
    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 on success, error code otherwise.
 */

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);

    return ResultFromScode(m_pObj->m_fDirty ? 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]);

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

    m_psState=PSSTATE_SCRIBBLE;

    //Initialize the cache as needed.
    m_pObj->m_pDefIPersistStorage->InitNew(pIStorage);
    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)
    {
    POLYLINEDATA    pl;
    ULONG           cb;
    LPSTREAM        pIStream;
    HRESULT         hr;

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

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

    //We don't check CLSID to remain compatible with other chapters.

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

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

    //Read all the data into the POLYLINEDATA structure.
    hr=pIStream->Read(&pl, CBPOLYLINEDATA, &cb);

    if (FAILED(hr) || CBPOLYLINEDATA!=cb)
        {
        pIStream->Release();
        return hr;
        }

    /*
     * 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;

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

    //DataSet now internal on CPolyline
    m_pObj->DataSet(&pl, TRUE, TRUE);

    m_psState=PSSTATE_SCRIBBLE;

    //We also need to tell the cache to load cached graphics
    m_pObj->m_pDefIPersistStorage->Load(pIStorage);
    return NOERROR;
    }





/*
 * CImpIPersistStorage::Save
 *
 * 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)
    {
    POLYLINEDATA    pl;
    ULONG           cb;
    LPSTREAM        pIStream;
    HRESULT         hr;

    //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 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 (fSameAsLoad)
        {
        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;

        //Only do this with new storages.
        WriteFmtUserTypeStg(pIStorage, m_pObj->m_cf
            , (*m_pObj->m_pST)[IDS_USERTYPE]);
        }

    //DataGet now internal on CPolyline
    m_pObj->DataGet(&pl);

    hr=pIStream->Write(&pl, CBPOLYLINEDATA, &cb);
    pIStream->Release();

    if (FAILED(hr) || CBPOLYLINEDATA!=cb)
        return ResultFromScode(STG_E_WRITEFAULT);

    m_psState=PSSTATE_ZOMBIE;

    //We also need to tell the cache to save cached graphics
    m_pObj->m_pDefIPersistStorage->Save(pIStorage, fSameAsLoad);
    return NOERROR;
    }








/*
 * 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();
        }

    //Change state back to scribble.
    m_psState=PSSTATE_SCRIBBLE;

    m_pObj->m_pDefIPersistStorage->SaveCompleted(pIStorage);
    return NOERROR;
    }





/*
 * CImpIPersistStorage::HandsOffStorage
 *
 * 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;

    m_pObj->m_pDefIPersistStorage->HandsOffStorage();
    return NOERROR;
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩女同互慰一区二区| 亚洲成a人片综合在线| 亚洲丝袜美腿综合| 国产在线精品一区二区| 91免费看`日韩一区二区| 欧美一区二区三区免费在线看| 久久久久久久久久电影| 天天做天天摸天天爽国产一区| 成人自拍视频在线| 精品久久人人做人人爱| 日韩影院免费视频| 色94色欧美sute亚洲线路一久| 久久精品人人爽人人爽| 免费成人小视频| 欧美日韩一级视频| 亚洲一区二区精品视频| 色噜噜狠狠成人中文综合| 国产精品狼人久久影院观看方式| 精品在线播放免费| 日韩欧美在线123| 日韩国产成人精品| 欧美人伦禁忌dvd放荡欲情| 亚洲伦在线观看| 91免费国产在线| 18成人在线视频| 99re成人在线| 一区二区三区自拍| 91丨九色丨蝌蚪丨老版| 国产精品美女www爽爽爽| 国产999精品久久| 国产亚洲成年网址在线观看| 国产乱码精品一区二区三| 久久夜色精品一区| 成人午夜视频在线观看| 中文字幕欧美区| 91在线精品一区二区三区| 国产精品电影一区二区| 99视频有精品| 一区二区三区在线免费| 欧美色综合网站| 日韩国产在线观看一区| 51精品国自产在线| 国产一区二区在线影院| 亚洲国产精品t66y| 一本久道久久综合中文字幕| 亚洲综合色在线| 91麻豆精品国产91久久久资源速度 | 欧美日韩一区小说| 日韩精品一二三区| 亚洲精品在线免费播放| 国产大陆精品国产| 国产精品美女一区二区三区| 色诱亚洲精品久久久久久| 天天操天天干天天综合网| 欧美α欧美αv大片| 国产不卡视频在线播放| 一区二区三区在线高清| 欧美一二三四在线| 成人动漫一区二区| 亚洲午夜久久久久| 337p粉嫩大胆色噜噜噜噜亚洲 | 一区二区三区在线观看动漫| 91精品啪在线观看国产60岁| 国产成人精品一区二区三区四区 | 99r国产精品| 日韩国产精品91| 中文在线一区二区 | 91麻豆精品秘密| 奇米在线7777在线精品| 国产色婷婷亚洲99精品小说| 欧美日韩中文一区| 国产传媒欧美日韩成人| 亚洲国产精品久久人人爱蜜臀| 久久这里只有精品首页| 在线一区二区视频| 国产成人免费视| 日韩精品成人一区二区三区| 日本一区二区三区在线不卡| 欧美精品在线观看播放| av在线播放一区二区三区| 老司机精品视频一区二区三区| 亚洲欧洲精品一区二区三区不卡| 欧美一区二区三区免费视频| 在线免费观看成人短视频| 国产成人在线影院| 麻豆精品视频在线观看免费| 亚洲精品成人在线| 中文字幕欧美一| 久久综合色一综合色88| 欧美人xxxx| 在线观看中文字幕不卡| 99综合影院在线| 成人午夜碰碰视频| 国产在线观看免费一区| 久久疯狂做爰流白浆xx| 亚洲国产精品一区二区久久恐怖片| 中文字幕乱码日本亚洲一区二区| 欧美不卡在线视频| 日韩一区二区三区视频在线| 欧美日韩一区二区在线观看| 色偷偷88欧美精品久久久| 99视频一区二区三区| 成人av电影在线播放| 国产91在线看| 国产成人精品在线看| 国产精品自产自拍| 国模少妇一区二区三区| 麻豆精品久久精品色综合| 青青草成人在线观看| 日韩电影网1区2区| 六月丁香婷婷久久| 久久国产精品99久久人人澡| 久久精品久久综合| 久久91精品国产91久久小草 | 午夜精品123| 日韩综合一区二区| 午夜精品福利一区二区三区蜜桃| 视频一区视频二区在线观看| 天天操天天色综合| 久久国内精品自在自线400部| 久久精品国产网站| 国产电影一区二区三区| 成人午夜看片网址| 色婷婷av一区二区| 欧美日韩成人综合在线一区二区| 欧美性生活大片视频| 欧美另类高清zo欧美| 欧美一区二区三区思思人| 日韩你懂的电影在线观看| 精品久久人人做人人爰| 国产精品午夜免费| 亚洲精品视频免费看| 无码av免费一区二区三区试看| 日本不卡视频在线观看| 国内成+人亚洲+欧美+综合在线| 国产成人精品1024| 北岛玲一区二区三区四区| 色婷婷综合久久久久中文 | 成年人午夜久久久| 欧美综合一区二区| 精品国产百合女同互慰| 一区二区中文字幕在线| 亚洲成av人片在线观看无码| 韩国欧美一区二区| 91麻豆免费在线观看| 69堂国产成人免费视频| 国产欧美日本一区二区三区| 亚洲精品一二三四区| 经典一区二区三区| 91香蕉国产在线观看软件| 日韩视频免费观看高清完整版在线观看| 精品剧情在线观看| 亚洲一区二区三区在线播放| 国内精品自线一区二区三区视频| 一本色道久久综合亚洲精品按摩| 日韩欧美中文字幕精品| 亚洲激情av在线| 国内外精品视频| 欧美日韩一区在线观看| 国产精品美女久久久久久久网站| 日韩av不卡一区二区| 99精品偷自拍| 久久精品视频网| 青青草伊人久久| 欧美系列亚洲系列| 国产精品人妖ts系列视频| 日韩av电影免费观看高清完整版| 91猫先生在线| 中文一区一区三区高中清不卡| 婷婷久久综合九色综合绿巨人| 成人一区二区三区视频| 欧美成人r级一区二区三区| 亚洲一区二区三区精品在线| 成人app网站| 久久亚洲综合色一区二区三区| 午夜影院久久久| 91福利精品视频| 亚洲视频 欧洲视频| 国产电影一区二区三区| www一区二区| 轻轻草成人在线| 在线观看91av| 日韩电影在线看| 欧美精品高清视频| 亚洲一二三四区| 在线精品视频小说1| 中文字幕一区三区| 成人黄色一级视频| 国产精品日日摸夜夜摸av| 国产成人综合视频| 欧美国产日韩一二三区| 国产九色sp调教91| 国产婷婷色一区二区三区四区| 精品一区二区三区在线观看国产| 欧美色图在线观看| 亚洲福利电影网| 欧美日韩免费在线视频| 五月天亚洲婷婷| 91精品国产黑色紧身裤美女| 偷拍亚洲欧洲综合|