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 / iipobj.cpp < prev    next >
C/C++ Source or Header  |  1995-05-03  |  4KB  |  194 lines

  1. /*
  2.  * IIPOBJ.CPP
  3.  *
  4.  * Template IOleInPlaceObject 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 "iipobj.h"
  15.  
  16.  
  17. /*
  18.  * CImpIOleInPlaceObject::CImpIOleInPlaceObject
  19.  * CImpIOleInPlaceObject::~CImpIOleInPlaceObject
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIOleInPlaceObject::CImpIOleInPlaceObject(LPVOID pObj
  27.     , LPUNKNOWN pUnkOuter)
  28.     {
  29.     m_cRef=0;
  30.     m_pObj=pObj;
  31.     m_pUnkOuter=pUnkOuter;
  32.     return;
  33.     }
  34.  
  35. CImpIOleInPlaceObject::~CImpIOleInPlaceObject(void)
  36.     {
  37.     return;
  38.     }
  39.  
  40.  
  41.  
  42. /*
  43.  * CImpIOleInPlaceObject::QueryInterface
  44.  * CImpIOleInPlaceObject::AddRef
  45.  * CImpIOleInPlaceObject::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIOleInPlaceObject.
  49.  */
  50.  
  51. STDMETHODIMP CImpIOleInPlaceObject::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIOleInPlaceObject::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIOleInPlaceObject::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71.  
  72. /*
  73.  * CImpIOleInPlaceObject::GetWindow
  74.  *
  75.  * Purpose:
  76.  *  Retrieves the handle of the window associated with the object on
  77.  *  which this interface is implemented.
  78.  *
  79.  * Parameters:
  80.  *  phWnd           HWND * in which to store the window handle.
  81.  *
  82.  * Return Value:
  83.  *  HRESULT         NOERROR if successful, E_FAIL if no window.
  84.  */
  85.  
  86. STDMETHODIMP CImpIOleInPlaceObject::GetWindow(HWND *phWnd)
  87.     {
  88.     return ResultFromScode(E_FAIL);
  89.     }
  90.  
  91.  
  92.  
  93.  
  94. /*
  95.  * CImpIOleInPlaceObject::ContextSensitiveHelp
  96.  *
  97.  * Purpose:
  98.  *  Instructs the object on which this interface is implemented to
  99.  *  enter or leave a context-sensitive help mode.
  100.  *
  101.  * Parameters:
  102.  *  fEnterMode      BOOL TRUE to enter the mode, FALSE otherwise.
  103.  */
  104.  
  105. STDMETHODIMP CImpIOleInPlaceObject::ContextSensitiveHelp(
  106.     BOOL fEnterMode)
  107.     {
  108.     return ResultFromScode(E_NOTIMPL);
  109.     }
  110.  
  111.  
  112.  
  113.  
  114. /*
  115.  * CImpIOleInPlaceObject::InPlaceDeactivate
  116.  *
  117.  * Purpose:
  118.  *  Instructs the object to deactivate itself from an in-place
  119.  *  state and to discard any Undo state.
  120.  *
  121.  * Parameters:
  122.  *  None
  123.  */
  124.  
  125. STDMETHODIMP CImpIOleInPlaceObject::InPlaceDeactivate(void)
  126.     {
  127.     return ResultFromScode(E_NOTIMPL);
  128.     }
  129.  
  130.  
  131.  
  132.  
  133. /*
  134.  * CImpIOleInPlaceObject::UIDeactivate
  135.  *
  136.  * Purpose:
  137.  *  Instructs the object to just remove any in-place user
  138.  *  interface but to do no other deactivation.  The object
  139.  *  should just hide the UI components but not destroy them
  140.  *  until InPlaceDeactivate is called.
  141.  *
  142.  * Parameters:
  143.  *  None
  144.  */
  145.  
  146. STDMETHODIMP CImpIOleInPlaceObject::UIDeactivate(void)
  147.     {
  148.     return ResultFromScode(E_NOTIMPL);
  149.     }
  150.  
  151.  
  152.  
  153.  
  154. /*
  155.  * CImpIOleInPlaceObject::SetObjectRects
  156.  *
  157.  * Purpose:
  158.  *  Provides the object with rectangles describing the position
  159.  *  of the object in the container window as well as its visible
  160.  *  area.  The object must reposition according to these rectangles.
  161.  *
  162.  * Parameters:
  163.  *  prcPos          LPCRECT providing the object's full rectangle
  164.  *                  relative to the continer's document.  The object
  165.  *                  should scale to this rectangle.
  166.  *  prcClip         LPCRECT describing the visible area of the object
  167.  *                  which should not draw outside these areas.
  168.  */
  169.  
  170. STDMETHODIMP CImpIOleInPlaceObject::SetObjectRects(LPCRECT prcPos
  171.     , LPCRECT prcClip)
  172.     {
  173.     return ResultFromScode(E_NOTIMPL);
  174.     }
  175.  
  176.  
  177.  
  178.  
  179. /*
  180.  * CImpIOleInPlaceObject::ReactivateAndUndo
  181.  *
  182.  * Purpose:
  183.  *  Instructs the object to reactivate itself in-place and perform
  184.  *  whatever Undo means for it.
  185.  *
  186.  * Parameters:
  187.  *  None
  188.  */
  189.  
  190. STDMETHODIMP CImpIOleInPlaceObject::ReactivateAndUndo(void)
  191.     {
  192.     return ResultFromScode(E_NOTIMPL);
  193.     }
  194.