home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / src / ctlcache.cpp < prev    next >
C/C++ Source or Header  |  1998-06-16  |  3KB  |  110 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef AFXCTL_CORE3_SEG
  14. #pragma code_seg(AFXCTL_CORE3_SEG)
  15. #endif
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. #define new DEBUG_NEW
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // COleControl::XOleCache
  26.  
  27. STDMETHODIMP_(ULONG) COleControl::XOleCache::AddRef()
  28. {
  29.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  30.     return (ULONG)pThis->ExternalAddRef();
  31. }
  32.  
  33. STDMETHODIMP_(ULONG) COleControl::XOleCache::Release()
  34. {
  35.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  36.     return (ULONG)pThis->ExternalRelease();
  37. }
  38.  
  39. STDMETHODIMP COleControl::XOleCache::QueryInterface(
  40.     REFIID iid, LPVOID* ppvObj)
  41. {
  42.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  43.     return (HRESULT)pThis->ExternalQueryInterface(&iid, ppvObj);
  44. }
  45.  
  46. STDMETHODIMP COleControl::XOleCache::Cache(LPFORMATETC lpFormatetc, DWORD advf,
  47.     LPDWORD lpdwConnection)
  48. {
  49.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  50.  
  51.     if (pThis->m_pDefIOleCache == NULL)
  52.         pThis->m_pDefIOleCache =
  53.             (LPOLECACHE)pThis->QueryDefHandler(IID_IOleCache);
  54.  
  55.     return pThis->m_pDefIOleCache->Cache(lpFormatetc, advf, lpdwConnection);
  56. }
  57.  
  58. STDMETHODIMP COleControl::XOleCache::Uncache(DWORD dwConnection)
  59. {
  60.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  61.  
  62.     if (pThis->m_pDefIOleCache == NULL)
  63.         pThis->m_pDefIOleCache =
  64.             (LPOLECACHE)pThis->QueryDefHandler(IID_IOleCache);
  65.  
  66.     return pThis->m_pDefIOleCache->Uncache(dwConnection);
  67. }
  68.  
  69. STDMETHODIMP COleControl::XOleCache::EnumCache(
  70.     LPENUMSTATDATA* ppenumStatData)
  71. {
  72.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  73.  
  74.     if (pThis->m_pDefIOleCache == NULL)
  75.         pThis->m_pDefIOleCache =
  76.             (LPOLECACHE)pThis->QueryDefHandler(IID_IOleCache);
  77.  
  78.     return pThis->m_pDefIOleCache->EnumCache(ppenumStatData);
  79. }
  80.  
  81. STDMETHODIMP COleControl::XOleCache::InitCache(LPDATAOBJECT pDataObject)
  82. {
  83.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  84.  
  85.     if (pThis->m_pDefIOleCache == NULL)
  86.         pThis->m_pDefIOleCache =
  87.             (LPOLECACHE)pThis->QueryDefHandler(IID_IOleCache);
  88.  
  89.     return pThis->m_pDefIOleCache->InitCache(pDataObject);
  90. }
  91.  
  92. STDMETHODIMP COleControl::XOleCache::SetData(LPFORMATETC pformatetc,
  93.     STGMEDIUM* pmedium, BOOL fRelease)
  94. {
  95.     METHOD_PROLOGUE_EX_(COleControl, OleCache)
  96.  
  97.     if (pThis->m_pDefIOleCache == NULL)
  98.         pThis->m_pDefIOleCache =
  99.             (LPOLECACHE)pThis->QueryDefHandler(IID_IOleCache);
  100.  
  101.     return pThis->m_pDefIOleCache->SetData(pformatetc, pmedium, fRelease);
  102. }
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105. // Force any extra compiler-generated code into AFX_INIT_SEG
  106.  
  107. #ifdef AFX_INIT_SEG
  108. #pragma code_seg(AFX_INIT_SEG)
  109. #endif
  110.