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

  1. /*
  2.  * ICONTROL.CPP
  3.  *
  4.  * Template IOleControl 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 "icontrol.h"
  15.  
  16.  
  17. /*
  18.  * CImpIOleControl::CImpIOleControl
  19.  * CImpIOleControl::~CImpIOleControl
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIOleControl::CImpIOleControl(LPVOID pObj
  27.     , LPUNKNOWN pUnkOuter)
  28.     {
  29.     m_cRef=0;
  30.     m_pObj=pObj;
  31.     m_pUnkOuter=pUnkOuter;
  32.     return;
  33.     }
  34.  
  35. CImpIOleControl::~CImpIOleControl(void)
  36.     {
  37.     return;
  38.     }
  39.  
  40.  
  41.  
  42. /*
  43.  * CImpIOleControl::QueryInterface
  44.  * CImpIOleControl::AddRef
  45.  * CImpIOleControl::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIOleControl.
  49.  */
  50.  
  51. STDMETHODIMP CImpIOleControl::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIOleControl::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIOleControl::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71. /*
  72.  * CImpIOleControl::GetControlInfo
  73.  *
  74.  * Purpose:
  75.  *  Fills a CONTROLINFO structure containing information about
  76.  *  the controls mnemonics and other behavioral aspects.
  77.  *
  78.  * Parameters:
  79.  *  pCI             LPCONTROLINFO to the structure to fill
  80.  */
  81.  
  82. STDMETHODIMP CImpIOleControl::GetControlInfo(LPCONTROLINFO pCI)
  83.     {
  84.     return ResultFromScode(E_NOTIMPL);
  85.     }
  86.  
  87.  
  88. /*
  89.  * CImpIOleControl::OnMnemonic
  90.  *
  91.  * Purpose:
  92.  *  Notifies the control that a mnemonic was activated.
  93.  *
  94.  * Parameters:
  95.  *  pMsg            LPMSG containing the message that matches one of
  96.  *                  the control's mnemonics.  The control uses this
  97.  *                  to distinguish which mnemonic was pressed.
  98.  */
  99.  
  100. STDMETHODIMP CImpIOleControl::OnMnemonic(LPMSG pMsg)
  101.     {
  102.     return ResultFromScode(E_NOTIMPL);
  103.     }
  104.  
  105.  
  106. /*
  107.  * CImpIOleControl::OnAmbientPropertyChange
  108.  *
  109.  * Purpose:
  110.  *  Notifies the control that one or more of the container's ambient
  111.  *  properties changed.
  112.  *
  113.  * Parameters:
  114.  *  dispID          DISPID identifying the property, which can
  115.  *                  be DISPID_UNKNOWN indicating that more than
  116.  *                  one changed.
  117.  */
  118.  
  119. STDMETHODIMP CImpIOleControl::OnAmbientPropertyChange(DISPID dispid)
  120.     {
  121.     return NOERROR;
  122.     }
  123.  
  124.  
  125.  
  126.  
  127. /*
  128.  * CImpIOleControl::FreezeEvents
  129.  *
  130.  * Purpose:
  131.  *  Instructs the control to stop firing events or to continue
  132.  *  firing them.
  133.  *
  134.  * Parameters:
  135.  *  fFreeze         BOOL indicating to freeze (TRUE) or thaw (FALSE)
  136.  *                  events from this control.
  137.  */
  138.  
  139. STDMETHODIMP CImpIOleControl::FreezeEvents(BOOL fFreeze)
  140.     {
  141.     return ResultFromScode(E_NOTIMPL);
  142.     }
  143.