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 / irunobj.cpp < prev    next >
C/C++ Source or Header  |  1995-05-03  |  3KB  |  176 lines

  1. /*
  2.  * IRUNOBJ.CPP
  3.  *
  4.  * Definitions of a template IRunnableObject interface
  5.  * implementation.
  6.  *
  7.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  8.  *
  9.  * Kraig Brockschmidt, Microsoft
  10.  * Internet  :  kraigb@microsoft.com
  11.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  12.  */
  13.  
  14.  
  15. #include "irunobj.h"
  16.  
  17.  
  18. /*
  19.  * CImpIRunnableObject::CImpIRunnableObject
  20.  * CImpIRunnableObject::~CImpIRunnableObject
  21.  *
  22.  * Parameters (Constructor):
  23.  *  pObj            LPVOID of the object we're in.
  24.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  25.  */
  26.  
  27. CImpIRunnableObject::CImpIRunnableObject(LPVOID pObj
  28.     , LPUNKNOWN pUnkOuter)
  29.     {
  30.     m_cRef=0;
  31.     m_pObj=pObj;
  32.     m_pUnkOuter=pUnkOuter;
  33.     return;
  34.     }
  35.  
  36. CImpIRunnableObject::~CImpIRunnableObject(void)
  37.     {
  38.     return;
  39.     }
  40.  
  41.  
  42.  
  43. /*
  44.  * CImpIRunnableObject::QueryInterface
  45.  * CImpIRunnableObject::AddRef
  46.  * CImpIRunnableObject::Release
  47.  *
  48.  * Purpose:
  49.  *  Delegating IUnknown members for CImpIRunnableObject.
  50.  */
  51.  
  52. STDMETHODIMP CImpIRunnableObject::QueryInterface(REFIID riid
  53.     , LPVOID *ppv)
  54.     {
  55.     return m_pUnkOuter->QueryInterface(riid, ppv);
  56.     }
  57.  
  58. STDMETHODIMP_(ULONG) CImpIRunnableObject::AddRef(void)
  59.     {
  60.     ++m_cRef;
  61.     return m_pUnkOuter->AddRef();
  62.     }
  63.  
  64. STDMETHODIMP_(ULONG) CImpIRunnableObject::Release(void)
  65.     {
  66.     --m_cRef;
  67.     return m_pUnkOuter->Release();
  68.     }
  69.  
  70.  
  71.  
  72.  
  73. /*
  74.  * CImpIRunnableObject::GetRunningClass
  75.  *
  76.  * Purpose:
  77.  *  Returns the CLSID of the object.
  78.  *
  79.  * Parameters:
  80.  *  pClsID          LPCLSID in which to store the CLSID.
  81.  */
  82.  
  83. STDMETHODIMP CImpIRunnableObject::GetRunningClass(LPCLSID pClsID)
  84.     {
  85.     return ResultFromScode(E_NOTIMPL);
  86.     }
  87.  
  88.  
  89.  
  90.  
  91.  
  92. /*
  93.  * CImpIRunnableObject::Run
  94.  *
  95.  * Purpose:
  96.  *  Run an object in the given bind context, that is, put the object
  97.  *  into the running state.
  98.  *
  99.  * Parameters:
  100.  *  pBindCtx        LPBINDCTX of the bind context to use.
  101.  */
  102.  
  103. STDMETHODIMP CImpIRunnableObject::Run(LPBINDCTX pBindCtx)
  104.     {
  105.     return ResultFromScode(E_NOTIMPL);
  106.     }
  107.  
  108.  
  109.  
  110.  
  111.  
  112. /*
  113.  * CImpIRunnableObject::IsRunning
  114.  *
  115.  * Purpose:
  116.  *  Answers whether an object is currently in the running state.
  117.  *
  118.  * Parameters:
  119.  *  None
  120.  *
  121.  * Return Value:
  122.  *  BOOL            Indicates the running state of the object.
  123.  */
  124.  
  125. STDMETHODIMP_(BOOL) CImpIRunnableObject::IsRunning(void)
  126.     {
  127.     return FALSE;
  128.     }
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135. /*
  136.  * CImpIRunnableObject::LockRunning
  137.  *
  138.  * Purpose:
  139.  *  Locks an already running object into the running state or unlocks
  140.  *  it from such a state.
  141.  *
  142.  * Parameters:
  143.  *  fLock               BOOL indicating lock (TRUE) or unlock
  144.  *                      (FALSE)
  145.  *  fLastUnlockCloses   BOOL indicating if the last call to this
  146.  *                      function with fLock==FALSE closes the
  147.  *                      object.
  148.  */
  149.  
  150. STDMETHODIMP CImpIRunnableObject::LockRunning(BOOL fLock
  151.     , BOOL fLastUnlockCloses)
  152.     {
  153.     return ResultFromScode(E_NOTIMPL);
  154.     }
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. /*
  162.  * CImpIRunnableObject::SetContainedObject
  163.  *
  164.  * Purpose:
  165.  *  Informs the object (embedded object) that it is inside a
  166.  *  compound document container.
  167.  *
  168.  * Parameters:
  169.  *  fContained      BOOL indicating if the object is now contained.
  170.  */
  171.  
  172. STDMETHODIMP CImpIRunnableObject::SetContainedObject(BOOL fContained)
  173.     {
  174.     return ResultFromScode(E_NOTIMPL);
  175.     }
  176.