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

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

?? autofigs.cpp

?? 英文版的 想要的話可以下載了 為大家服務
?? CPP
字號:
/*
 * AUTOFIGS.CPP
 * Cosmo Chapter 14
 *
 * "Figures" collection object for Cosmo's OLE Automation support,
 * derived from CAutoBase.
 *
 * Copyright (c)1993-1995 Microsoft Corporation, All Right Reserved.
 *
 * Kraig Brockschmidt, Microsoft
 * Internet  :  kraigb@microsoft.com
 * Compuserve:  INTERNET>kraigb@microsoft.com
 */


#include "cosmo.h"


/*
 * CAutoFigures::CAutoFigures
 * CAutoFigures::~CAutoFigures
 *
 * Constructor Parameters:
 *  pCL             PCCosmoClient to the client object that we use
 *                  to implement much of this interface.
 */

CAutoFigures::CAutoFigures(PCCosmoClient pCL)
    : CAutoBase(pCL, pCL->m_hInst, IID_ICosmoFigures
    , DIID_DICosmoFigures, NULL)
    {
    return;
    }


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




/*
 * CAutoFigures::QueryInterface
 * CAutoFigures::AddRef
 * CAutoFigures::Release
 */

STDMETHODIMP CAutoFigures::QueryInterface(REFIID riid, PPVOID ppv)
    {
    *ppv=NULL;

    if (IID_IUnknown==riid || IID_ICosmoFigures==riid)
        *ppv=(IUnknown *)this;

    if (IID_IDispatch==riid || m_diid==riid)
        *ppv=m_pImpIDispatch;

    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return ResultFromScode(E_NOINTERFACE);
    }

STDMETHODIMP_(ULONG) CAutoFigures::AddRef(void)
    {
    return ++m_cRef;
    }

STDMETHODIMP_(ULONG) CAutoFigures::Release(void)
    {
    //CCosmoClient deletes this object during shutdown
    if (0==--m_cRef)
        {
        /*
         * Note:  This early release is to avoid a bug in
         * Beta Windows NT 3.51 at the time this code was
         * finalized.  Technically it should be fine to leave
         * the Release call in CImpIDispatch::~CImpIDispatch
         * (see autobase.cpp), but making the call here
         * avoids a crash on a null pointer.
         */
        ReleaseInterface(m_pImpIDispatch->m_pITypeInfo);
        }
    return m_cRef;
    }




/*
 * CAutoFigures::VTableInterface
 *
 * Purpose:
 *  Returns the right vtable pointer to use when calling
 *  ITypeInfo::Invoke (see CImpIDispatch::Invoke in AUTOBASE.CPP).
 */
void *CAutoFigures::VTableInterface(void)
    {
    return (ICosmoFigures *)this;
    }



//The ICosmoFigures implementation

/*
 * CAutoFigures::Application
 * CAutoFigures::Parent
 * Properties, read-only
 *
 * The application object (CAutoApp) in which we're contained,
 * which is stored in the frame object.  Basically we walk
 * up from the client to the frame to it's application object
 * to get the IDispatch we need.
 */

STDMETHODIMP_(IDispatch *) CAutoFigures::get_Application(void)
    {
    PCCosmoFrame    pFR;

    pFR=(PCCosmoFrame)m_pCL->Frame();
    return pFR->AutoApp()->get_Application();
    }

STDMETHODIMP_(IDispatch *) CAutoFigures::get_Parent(void)
    {
    return get_Application();
    }



/*
 * CAutoFigures::Count
 * Property, read-only
 *
 * The number of figures in this collection
 */

STDMETHODIMP_(long) CAutoFigures::get_Count(void)
    {
    //This is easy:  just the number of items in the listbox.
    return m_pCL->m_cDoc;
    }



/*
 * CAutoFigures::Item
 * Method
 *
 * This is essentially an array lookup operator for the collection.
 * Collection.Item by itself the same as the collection itself.
 * Otherwise you can refer to the item by index or by path, which
 * shows up in the VARIANT parameter.  We have to check the type
 * of the variant to see if it's VT_I4 (an index) or VT_BSTR (a
 * path) and do the right thing.
 */

STDMETHODIMP_(IDispatch *) CAutoFigures::Item(VARIANT index)
    {
    IDispatch  *pIDispatch=NULL;
    PCCosmoDoc  pDoc;
    const int   cch=512;
    TCHAR       szPath[cch];
    UINT        i;
    HWND        hList=m_pCL->m_hListDocs;

    /*
     * Each case in this switch gets at a different pointer
     * and stores it in pIDispatch for return.
     */
    switch (index.vt)
        {
        case VT_ERROR:
            /*
             * No parameters, get the "Figures" collection
             * IDispatch, which we can easily retrieve with
             * our own QueryInterface.
             */
            QueryInterface(IID_IDispatch, (PPVOID)&pIDispatch);
            break;

        case VT_I4:
            if (LB_ERR!=SendMessage(hList, LB_GETTEXT
                , (int)index.lVal, (LONG)&pDoc))
                {
                //Sets pIDispatch to NULL on failure.
                pDoc->AutoFigure()->QueryInterface(IID_IDispatch
                    , (PPVOID)&pIDispatch);
                }

            break;

        case VT_BSTR:
            /*
             * First we'll iterate over the pages and check
             * for full path matches.  If that doesn't yield
             * anything, then we'll see if index.bstrVal is
             * just a filename inside one of the paths.
             */
            for (i=0; i < m_pCL->m_cDoc; i++)
                {
                if (LB_ERR!=SendMessage(hList, LB_GETTEXT
                    , i, (LONG)&pDoc))
                    {
                    pDoc->FilenameGet(szPath, cch);

                   #ifdef WIN32ANSI
                    char    szTemp[512];

                    WideCharToMultiByte(CP_ACP, 0, index.bstrVal, -1
                        , szTemp, 512, NULL, NULL);

                    if (0==lstrcmpi(szPath, szTemp))
                   #else
                    if (0==lstrcmpi(szPath, index.bstrVal))
                   #endif
                        {
                        //Found it...
                        pDoc->AutoFigure()->QueryInterface
                            (IID_IDispatch, (PPVOID)&pIDispatch);
                        }
                    }
                }

            //Stop now if we found anything.
            if (NULL!=pIDispatch)
                break;

            //Now look for portions of the path
            for (i=0; i < m_pCL->m_cDoc; i++)
                {
                if (LB_ERR!=SendMessage(hList, LB_GETTEXT
                    , i, (LONG)&pDoc))
                    {
                    LPTSTR  psz;

                    pDoc->FilenameGet(szPath, cch);

                   #ifdef WIN32ANSI
                    char    szTemp[512];

                    WideCharToMultiByte(CP_ACP, 0, index.bstrVal, -1
                        , szTemp, 512, NULL, NULL);
                    psz=_tcsstr(szPath, szTemp);
                   #else
                    psz=_tcsstr(szPath, index.bstrVal);
                   #endif

                    if (NULL!=psz)
                        {
                        //Found it...
                        pDoc->AutoFigure()->QueryInterface
                            (IID_IDispatch, (PPVOID)&pIDispatch);
                        }
                    }
                }


            break;

        default:
            return NULL;
        }

    return pIDispatch;
    }



/*
 * CAutoFigures::Add
 * CAutoFigures::Open
 * Methods
 *
 * Creates a new figure window with an empty figure (Add) or one
 * with the contents of a file (Open), and adds it to the collection.
 */

STDMETHODIMP_(IDispatch *) CAutoFigures::Add(void)
    {
    return NewFigure(NULL);
    }

STDMETHODIMP_(IDispatch *) CAutoFigures::Open(BSTR bstrPath)
    {
   #ifdef WIN32ANSI
    char        szTemp[512];

    WideCharToMultiByte(CP_ACP, 0, bstrPath, -1, szTemp
        , 512, NULL, NULL);
    return NewFigure(szTemp);
   #else
    return NewFigure(bstrPath);
   #endif
    }



/*
 * CAutoFigures:NewFigure
 *
 * Purpose:
 *  Internal helper function to centralize figure creation for
 *  Add and Open.
 *
 * Parameters:
 *  pszPath         LPTSTR to a file to open if this is an open.
 *                  Should be NULL for Add.
 *
 * Return Value:
 *  IDispatch *     Return value for Add and Open
 */

IDispatch * CAutoFigures::NewFigure(LPTSTR pszPath)
    {
    PCCosmoDoc  pDoc;
    IDispatch  *pIDispatch=NULL;
    HRESULT     hr;

    //Try creating a hidden document, which creates the object.
    pDoc=(PCCosmoDoc)m_pCL->NewDocument(FALSE);

    if (NULL==pDoc)
        return NULL;

    hr=ResultFromScode(E_FAIL);

    //Try to load the file and get the IDispatch for the document
    if (DOCERR_NONE==pDoc->Load(TRUE, pszPath))
        {
        hr=pDoc->AutoFigure()->QueryInterface(IID_IDispatch
            , (PPVOID)&pIDispatch);
        }

    if (FAILED(hr))
        m_pCL->CloseDocument(pDoc);
    else
        g_cObj++;

    return pIDispatch;
    }





/*
 * CAutoFigures::Close
 * Method
 *
 * Closes all figure windows in the collection
 */

STDMETHODIMP_(void) CAutoFigures::Close(void)
    {
    m_pCL->QueryCloseAllDocuments(TRUE, FALSE);
    return;
    }





/*
 * CAutoFigures::_NewEnum
 * Method
 *
 * Creates and returns an enumerator of the current list of
 * figures in this collection.
 */

STDMETHODIMP_(IUnknown *) CAutoFigures::_NewEnum(void)
    {
    PCEnumFigures   pNew=NULL;
    BOOL            fRet=TRUE;

    pNew=new CEnumFigures(m_pCL->Instance());

    if (NULL!=pNew)
        {
        if (!pNew->Init(m_pCL->m_hListDocs, FALSE))
            {
            delete pNew;
            pNew=NULL;
            }
        else
            pNew->AddRef();
        }

    return (IUnknown *)pNew;
    }




//CEnumFigures implementation of IEnumVARIANT


/*
 * CEnumFigures::CEnumFigures
 * CEnumFigures::~CEnumFigures
 *
 * Parameters (Constructor):
 *  hInst           HINSTANCE of the application.
 */

CEnumFigures::CEnumFigures(HINSTANCE hInst)
    {
    m_cRef=0;
    m_hList=NULL;
    m_hInst=hInst;
    m_iCur=0;
    m_cItems=0;
    return;
    }


CEnumFigures::~CEnumFigures(void)
    {
    if (NULL!=m_hList)
        DestroyWindow(m_hList);

    return;
    }



/*
 * CEnumFigures::Init
 *
 * Purpose:
 *  Initializes the enumeration with any operations that might fail.
 *
 * Parameters:
 *  hListPDoc       HWND of the listbox containing the current
 *                  set of document pointers.
 *  fClone          BOOL indicating if this is a clone creation
 *                  in which case hListPDoc already has what we want
 *                  and we can just copy it directly.
 *
 * Return Value:
 *  BOOL            TRUE if initialization succeeded,
 *                  FALSE otherwise.
 */
BOOL CEnumFigures::Init(HWND hListPDoc, BOOL fClone)
    {
    UINT        i;
    UINT        cDoc;
    PCDocument  pDoc;

    //Create our own list
    m_hList=CreateWindow(TEXT("listbox"), TEXT("EnumList")
        , WS_POPUP | LBS_OWNERDRAWFIXED, 0, 0, 100, 100
        , HWND_DESKTOP, NULL, m_hInst, NULL);

    if (NULL==m_hList)
        return FALSE;

    /*
     * An enumeration should not be attached to any sort of
     * dynamic list, so we have to initialize our own list here.
     * Furthermore, the hList we get here has document object
     * pointers which could possibly become invalid and we have
     * no way of knowing it.  So we take each pointer and copy
     * the window handle of that document into our own list.  If
     * the window is destroyed, then we have a way of checking
     * that condition and failing to return a valid pointer
     * in other partsof this enumerator.
     */

    cDoc=(UINT)SendMessage(hListPDoc, LB_GETCOUNT, 0, 0L);

    for (i=0; i < cDoc; i++)
        {
        if (LB_ERR!=SendMessage(hListPDoc, LB_GETTEXT, i
            , (LONG)&pDoc))
            {
            HWND    hWndDoc;

            //When cloning we have the window handle already.
            if (fClone)
                hWndDoc=(HWND)(UINT)(LONG)pDoc;
            else
                hWndDoc=pDoc->Window();

            if (LB_ERR!=SendMessage(m_hList, LB_ADDSTRING, 0
                , (LONG)(UINT)hWndDoc))
                m_cItems++;
            }
        }

    return TRUE;
    }



/*
 * CEnumFigures::QueryInterface
 * CEnumFigures::AddRef
 * CEnumFigures::Release
 */

STDMETHODIMP CEnumFigures::QueryInterface(REFIID riid, PPVOID ppv)
    {
    *ppv=NULL;

    if (IID_IUnknown==riid || IID_IEnumVARIANT==riid)
        *ppv=this;

    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return ResultFromScode(E_NOINTERFACE);
    }


STDMETHODIMP_(ULONG) CEnumFigures::AddRef(void)
    {
    ++m_cRef;
    return m_cRef;
    }

STDMETHODIMP_(ULONG) CEnumFigures::Release(void)
    {
    ULONG       cRefT;

    cRefT=--m_cRef;

    if (0L==m_cRef)
        delete this;

    return cRefT;
    }


/*
 * CEnumFigures::Next
 * CEnumFigures::Skip
 * CEnumFigures::Reset
 * CEnumFigures::Clone
 *
 * Standard enumerator members for IEnumVARIANT
 */

STDMETHODIMP CEnumFigures::Next(ULONG cVar, VARIANT *pVar
    , ULONG *pulVar)
    {
    ULONG       cReturn=0L;
    PCCosmoDoc  pDoc;
    HRESULT     hr;
    void       *pv;
    LONG        l;

    if (NULL==pulVar)
        {
        if (1L!=cVar)
            return ResultFromScode(E_POINTER);
        }
    else
        *pulVar=0L;

    if (NULL==pVar || m_iCur >= m_cItems)
        return ResultFromScode(S_FALSE);

    while (m_iCur < m_cItems && cVar > 0)
        {
        if (LB_ERR==SendMessage(m_hList, LB_GETTEXT, (UINT)m_iCur++
            , (LONG)&l))
            continue;

        /*
         * Try getting the document pointer.  If this fails
         * then the window is invalid (document is destroyed)
         * so remove it from the list for future enumerations.
         */
        pDoc=(PCCosmoDoc)SendMessage((HWND)(UINT)l
            , DOCM_PDOCUMENT, 0, 0L);

        if (NULL==pDoc)
            {
            SendMessage(m_hList, LB_DELETESTRING, (UINT)--m_iCur, 0L);
            continue;
            }

        hr=pDoc->AutoFigure()->QueryInterface(IID_IDispatch, &pv);

        if (SUCCEEDED(hr))
            {
            *pVar->ppdispVal=(IDispatch *)pv;
            pVar++;
            cReturn++;
            cVar--;
            }
        }


    if (NULL!=pulVar)
        *pulVar=cReturn;

    return NOERROR;
    }


STDMETHODIMP CEnumFigures::Skip(ULONG cSkip)
    {
    if ((m_iCur+cSkip) >= m_cItems)
        return ResultFromScode(S_FALSE);

    m_iCur+=cSkip;
    return NOERROR;
    }


STDMETHODIMP CEnumFigures::Reset(void)
    {
    m_iCur=0;
    return NOERROR;
    }


STDMETHODIMP CEnumFigures::Clone(LPENUMVARIANT *ppEnum)
    {
    PCEnumFigures   pNew;

    *ppEnum=NULL;

    pNew=new CEnumFigures(m_hInst);

    if (NULL!=pNew)
        {
        if (!pNew->Init(m_hList, TRUE))
            {
            delete pNew;
            pNew=NULL;
            }
        else
            pNew->AddRef();
        }

    *ppEnum=(IEnumVARIANT *)pNew;
    return (NULL!=pNew) ? NOERROR : ResultFromScode(E_OUTOFMEMORY);
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二区在线播放 | 欧美日韩一级黄| 日韩中文字幕区一区有砖一区 | 中文字幕一区二区在线观看| 日韩一区国产二区欧美三区| 91性感美女视频| 国产在线乱码一区二区三区| 亚洲18女电影在线观看| 自拍偷拍国产亚洲| 久久久久亚洲综合| 日韩一区二区三区电影在线观看| 色综合天天综合网天天看片| 国产综合色精品一区二区三区| 石原莉奈在线亚洲三区| 亚洲精品高清视频在线观看| 欧美国产成人精品| 精品乱人伦小说| 日韩一二三区视频| 欧美日韩激情一区二区三区| 色天天综合色天天久久| 成人一道本在线| 国产美女一区二区三区| 麻豆精品视频在线观看免费 | 美女在线视频一区| 午夜精品一区二区三区免费视频 | 视频一区中文字幕| 亚洲午夜av在线| 亚洲一区二区三区四区在线免费观看 | 色综合亚洲欧洲| 99久久久免费精品国产一区二区| 成人福利视频网站| 国产91在线看| 国产大陆精品国产| 国产成人啪午夜精品网站男同| 黑人巨大精品欧美一区| 久久精品国产精品亚洲红杏| 美腿丝袜亚洲色图| 久久国产生活片100| 久久精品国产色蜜蜜麻豆| 美女网站色91| 国产一区二区三区四区在线观看| 久久99精品国产.久久久久久| 强制捆绑调教一区二区| 美女看a上一区| 狠狠色丁香久久婷婷综| 国产福利91精品一区| 成人久久久精品乱码一区二区三区| 国产麻豆日韩欧美久久| 国产精品亚洲第一| 成人99免费视频| 色婷婷久久99综合精品jk白丝| 色伊人久久综合中文字幕| 欧美在线观看一区二区| 欧美色网站导航| 日韩色在线观看| 国产色婷婷亚洲99精品小说| 国产精品女人毛片| 亚洲在线观看免费视频| 日韩精品成人一区二区三区| 韩国女主播成人在线观看| 国产成人av网站| 91美女视频网站| 6080国产精品一区二区| 亚洲精品一区二区三区影院| 中文字幕一区二区三区在线不卡| 一区二区三区 在线观看视频| 天堂va蜜桃一区二区三区| 久久精品国内一区二区三区 | 91精品一区二区三区久久久久久 | 日日夜夜精品免费视频| 极品瑜伽女神91| 91在线视频在线| 欧美伦理电影网| 国产亚洲精品中文字幕| 亚洲男人的天堂av| 久久国产人妖系列| 色综合久久久久久久久| 欧美一区二区三区性视频| 国产人妖乱国产精品人妖| 亚洲专区一二三| 韩国女主播成人在线| 色88888久久久久久影院按摩| 日韩欧美中文字幕一区| 亚洲色图丝袜美腿| 黄网站免费久久| 欧美在线视频不卡| 久久精品一区二区三区av | 国产剧情一区在线| 欧美视频你懂的| 国产精品久久久久精k8| 欧美aa在线视频| 91国产视频在线观看| 国产女同性恋一区二区| 蜜臀a∨国产成人精品| 99国产欧美另类久久久精品 | 欧美成人精精品一区二区频| 亚洲男人的天堂在线aⅴ视频| 国产美女精品一区二区三区| 欧美亚洲国产一区在线观看网站| 久久天天做天天爱综合色| 亚洲国产精品一区二区尤物区| 成人午夜激情影院| 精品少妇一区二区三区日产乱码| 一区二区激情视频| av亚洲精华国产精华| 精品99一区二区三区| 午夜精品一区二区三区三上悠亚| av亚洲精华国产精华精| 国产日韩亚洲欧美综合| 久久不见久久见免费视频7 | 久久一日本道色综合| 午夜私人影院久久久久| 91在线国内视频| 国产精品久久午夜| 国产麻豆视频一区二区| 欧美mv日韩mv国产网站app| 亚洲成a人v欧美综合天堂下载| 色综合激情五月| 中文字幕一区二区三区四区 | 色婷婷国产精品| 国产精品久久久久一区二区三区共| 国产一区二区电影| 欧美白人最猛性xxxxx69交| 视频一区欧美精品| 91精品黄色片免费大全| 亚洲成人av福利| 欧美日韩免费一区二区三区| 亚洲黄色小视频| 色婷婷久久久亚洲一区二区三区| 亚洲啪啪综合av一区二区三区| av中文字幕在线不卡| 国产精品电影院| 91一区二区三区在线播放| 亚洲视频在线一区观看| 91国产免费看| 亚洲v精品v日韩v欧美v专区| 欧美日韩小视频| 日精品一区二区三区| 91精品国产欧美一区二区成人| 亚洲高清视频中文字幕| 欧美日韩午夜在线视频| 日韩不卡一区二区三区 | 自拍偷拍亚洲综合| 色婷婷国产精品| 午夜精品在线看| 精品国产乱码久久久久久久久 | 欧美一区二区三区系列电影| 蜜桃免费网站一区二区三区| 欧美www视频| 国产成人精品免费视频网站| 日韩一区在线播放| 在线观看一区不卡| 天堂在线亚洲视频| 日韩一区二区中文字幕| 国产精品1区二区.| 中文字幕一区免费在线观看| 欧洲中文字幕精品| 亚洲成人激情av| 日韩午夜av电影| 国产成人精品免费看| 亚洲精品精品亚洲| 5566中文字幕一区二区电影| 国产一区二区三区四| 亚洲欧美日韩在线不卡| 欧美日韩综合在线免费观看| 麻豆精品在线看| 成人免费小视频| 8x8x8国产精品| 国产一区久久久| 一区二区三区精品视频在线| 日韩女优电影在线观看| caoporen国产精品视频| 午夜av一区二区三区| 国产夜色精品一区二区av| 色成人在线视频| 美女性感视频久久| 亚洲色图制服诱惑| 精品成人在线观看| 91片在线免费观看| 精品一区二区三区的国产在线播放| 日韩一区在线免费观看| 欧美一区二区大片| 91色视频在线| 捆绑调教美女网站视频一区| 亚洲女性喷水在线观看一区| 久久伊人中文字幕| 欧美午夜电影在线播放| 国产成人免费9x9x人网站视频| 午夜电影网亚洲视频| 欧美国产日韩a欧美在线观看| 欧美精品丝袜久久久中文字幕| www.久久久久久久久| 精品一区二区三区久久| 亚洲国产乱码最新视频 | 欧美日韩国产精选| 成人免费视频免费观看| 久久国产视频网| 丝瓜av网站精品一区二区 | 国产欧美一区二区精品秋霞影院| 欧美少妇xxx|