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

  1. /*
  2.  * IPROPNOT.CPP
  3.  *
  4.  * Template implementation of IPropertyNotifySink
  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 "ipropnot.h"
  15.  
  16.  
  17. /*
  18.  * CImpIPropertyNotifySink::CImpIPropertyNotifySink
  19.  * CImpIPropertyNotifySink::~CImpIPropertyNotifySink
  20.  *
  21.  * Constructor Parameters:
  22.  *  pObj            LPVOID of the object containing us.
  23.  *  pUnkOuter       LPUNKNOWN to which we blindly delegate
  24.  *                  all IUnknown calls.
  25.  */
  26.  
  27. CImpIPropertyNotifySink::CImpIPropertyNotifySink(LPVOID pObj
  28.     , LPUNKNOWN pUnkOuter)
  29.     {
  30.     m_cRef=0;
  31.     m_pObj=pObj;
  32.     m_pUnkOuter=pUnkOuter;
  33.     return;
  34.     }
  35.  
  36. CImpIPropertyNotifySink::~CImpIPropertyNotifySink(void)
  37.     {
  38.     return;
  39.     }
  40.  
  41.  
  42. /*
  43.  * CImpIPropertyNotifySink::QueryInterface
  44.  * CImpIPropertyNotifySink::AddRef
  45.  * CImpIPropertyNotifySink::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIPropertyNotifySink.
  49.  */
  50.  
  51. STDMETHODIMP CImpIPropertyNotifySink::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIPropertyNotifySink::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIPropertyNotifySink::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71. /*
  72.  * CImpIPropertyNotifySink::OnChanged
  73.  *
  74.  * Purpose:
  75.  *  Notifies this sink that the property identified with dispID
  76.  *  has changed in whatever object this sink is connected to.
  77.  *
  78.  * Parameters:
  79.  *  dispID          DISPID of the property that changed,
  80.  *                  which can be DISPID_UNKNOWN for unspecified
  81.  *                  changes to multiple properties.
  82.  *
  83.  * Return Value:
  84.  *  HRESULT         NOERROR always.
  85.  */
  86.  
  87. STDMETHODIMP CImpIPropertyNotifySink::OnChanged(DISPID dispID)
  88.     {
  89.     return NOERROR;
  90.     }
  91.  
  92.  
  93.  
  94. /*
  95.  * CImpIPropertyNotifySink::OnRequestEdit
  96.  *
  97.  * Purpose:
  98.  *  Notifies this sink that the property identified with dispID
  99.  *  is about to change and that the sink can prevent the change
  100.  *  if desired.  This can be used to enforce read-only states or
  101.  *  to save prior states before the change occurs.
  102.  *
  103.  * Parameters:
  104.  *  dispID          DISPID of the property that is changing
  105.  *                  which can be DISPID_UNKNOWN for multiple
  106.  *                  properties.
  107.  *
  108.  * Return Value:
  109.  *  HRESULT         NOERROR if the property can change, S_FALSE
  110.  *                  if it cannot change, error code otherwise.
  111.  */
  112.  
  113. STDMETHODIMP CImpIPropertyNotifySink::OnRequestEdit(DISPID dispID)
  114.     {
  115.     return NOERROR;
  116.     }
  117.