home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / interfac / iclisite.cpp < prev    next >
C/C++ Source or Header  |  1995-05-03  |  4KB  |  204 lines

  1. /*
  2.  * ICLISITE.CPP
  3.  *
  4.  * Template IOleClientSite interface implementation.
  5.  *
  6.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  7.  *
  8.  * Kraig Brockschmidt, Microsoft
  9.  * Internet  :  kraigb@microsoft.com
  10.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  11.  */
  12.  
  13.  
  14. #include "iclisite.h"
  15.  
  16.  
  17. /*
  18.  * CImpIOleClientSite::CImpIOleClientSite
  19.  * CImpIOleClientSite::~CImpIOleClientSite
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIOleClientSite::CImpIOleClientSite(LPVOID pObj
  27.     , LPUNKNOWN pUnkOuter)
  28.     {
  29.     m_cRef=0;
  30.     m_pObj=pObj;
  31.     m_pUnkOuter=pUnkOuter;
  32.     return;
  33.     }
  34.  
  35. CImpIOleClientSite::~CImpIOleClientSite(void)
  36.     {
  37.     return;
  38.     }
  39.  
  40.  
  41.  
  42.  
  43. /*
  44.  * CImpIOleClientSite::QueryInterface
  45.  * CImpIOleClientSite::AddRef
  46.  * CImpIOleClientSite::Release
  47.  *
  48.  * Purpose:
  49.  *  Delegating IUnknown members for CImpIOleClientSite.
  50.  */
  51.  
  52. STDMETHODIMP CImpIOleClientSite::QueryInterface(REFIID riid
  53.     , LPVOID *ppv)
  54.     {
  55.     return m_pUnkOuter->QueryInterface(riid, ppv);
  56.     }
  57.  
  58. STDMETHODIMP_(ULONG) CImpIOleClientSite::AddRef(void)
  59.     {
  60.     ++m_cRef;
  61.     return m_pUnkOuter->AddRef();
  62.     }
  63.  
  64. STDMETHODIMP_(ULONG) CImpIOleClientSite::Release(void)
  65.     {
  66.     --m_cRef;
  67.     return m_pUnkOuter->Release();
  68.     }
  69.  
  70.  
  71.  
  72.  
  73. /*
  74.  * CImpIOleClientSite::SaveObject
  75.  *
  76.  * Purpose:
  77.  *  Requests that the container call OleSave for the object that
  78.  *  lives here.  Typically this happens on server shutdown.
  79.  *
  80.  * Parameters:
  81.  *  None
  82.  */
  83.  
  84. STDMETHODIMP CImpIOleClientSite::SaveObject(void)
  85.     {
  86.     return NOERROR;
  87.     }
  88.  
  89.  
  90.  
  91.  
  92.  
  93. /*
  94.  * CImpIOleClientSite::GetMoniker
  95.  *
  96.  * Purpose:
  97.  *  Retrieves the moniker for the site in which this object lives,
  98.  *  either the moniker relative to the container or the full
  99.  *  moniker.
  100.  *
  101.  * Parameters:
  102.  *  dwAssign        DWORD specifying that the object wants moniker
  103.  *                  assignment.
  104.  *  dwWhich         DWORD identifying which moniker the object wants,
  105.  *                  either the container's moniker, the moniker
  106.  *                  relative to this client site, or the full moniker.
  107.  */
  108.  
  109. STDMETHODIMP CImpIOleClientSite::GetMoniker(DWORD dwAssign
  110.     , DWORD dwWhich, LPMONIKER *ppmk)
  111.     {
  112.     //Only necessary if you allow linking to embeddings
  113.     *ppmk=NULL;
  114.     return ResultFromScode(E_NOTIMPL);
  115.     }
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. /*
  123.  * CImpIOleClientSite::GetContainer
  124.  *
  125.  * Purpose:
  126.  *  Returns a pointer to the document's IOleContainer interface.
  127.  *
  128.  * Parameters:
  129.  *  ppContainer     LPOLECONTAINER * in which to return the
  130.  *                  interface.
  131.  */
  132.  
  133. STDMETHODIMP CImpIOleClientSite::GetContainer(LPOLECONTAINER
  134.     *ppContainer)
  135.     {
  136.     //Only necessary if you allow linking to embeddings
  137.     *ppContainer=NULL;
  138.     return ResultFromScode(E_NOTIMPL);
  139.     }
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146. /*
  147.  * CImpIOleClientSite::ShowObject
  148.  *
  149.  * Purpose:
  150.  *  Tells the container to bring the object fully into view as
  151.  *  much as possible, that is, scroll the document.
  152.  *
  153.  * Parameters:
  154.  *  None
  155.  */
  156.  
  157. STDMETHODIMP CImpIOleClientSite::ShowObject(void)
  158.     {
  159.     return NOERROR;
  160.     }
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. /*
  168.  * CImpIOleClientSite::OnShowWindow
  169.  *
  170.  * Purpose:
  171.  *  Informs the container if the object is showing itself or
  172.  *  hiding itself.  This is done only in the opening mode and allows
  173.  *  the container to know when to shade or unshade the object.
  174.  *
  175.  * Parameters:
  176.  *  fShow           BOOL indiciating that the object is being shown
  177.  *                  (TRUE) or hidden (FALSE).
  178.  */
  179.  
  180. STDMETHODIMP CImpIOleClientSite::OnShowWindow(BOOL fShow)
  181.     {
  182.     return NOERROR;
  183.     }
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. /*
  191.  * CImpIOleClientSite::RequestNewObjectLayout
  192.  *
  193.  * Purpose:
  194.  *  Called when the object needs more room in the container.
  195.  *
  196.  * Parameters:
  197.  *  None
  198.  */
  199.  
  200. STDMETHODIMP CImpIOleClientSite::RequestNewObjectLayout(void)
  201.     {
  202.     return ResultFromScode(E_NOTIMPL);
  203.     }
  204.