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 / iipuiwin.cpp < prev    next >
C/C++ Source or Header  |  1995-05-03  |  5KB  |  206 lines

  1. /*
  2.  * IIPUIWIN.CPP
  3.  *
  4.  * Template IOleInPlaceUIWIndow 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 "iipuiwin.h"
  15.  
  16.  
  17. /*
  18.  * CImpIOleInPlaceUIWindow::CImpIOleInPlaceUIWindow
  19.  * CImpIOleInPlaceUIWindow::~CImpIOleInPlaceUIWindow
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIOleInPlaceUIWindow::CImpIOleInPlaceUIWindow(LPVOID pObj
  27.     , LPUNKNOWN pUnkOuter)
  28.     {
  29.     m_cRef=0;
  30.     m_pObj=pObj;
  31.     m_pUnkOuter=pUnkOuter;
  32.     return;
  33.     }
  34.  
  35. CImpIOleInPlaceUIWindow::~CImpIOleInPlaceUIWindow(void)
  36.     {
  37.     return;
  38.     }
  39.  
  40.  
  41.  
  42. /*
  43.  * CImpIOleInPlaceUIWindow::QueryInterface
  44.  * CImpIOleInPlaceUIWindow::AddRef
  45.  * CImpIOleInPlaceUIWindow::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIOleInPlaceUIWindow.
  49.  */
  50.  
  51. STDMETHODIMP CImpIOleInPlaceUIWindow::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIOleInPlaceUIWindow::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIOleInPlaceUIWindow::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71.  
  72. /*
  73.  * CImpIOleInPlaceUIWindow::GetWindow
  74.  *
  75.  * Purpose:
  76.  *  Retrieves the handle of the window associated with the object
  77.  *  on 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 CImpIOleInPlaceUIWindow::GetWindow(HWND *phWnd)
  87.     {
  88.     return ResultFromScode(E_FAIL);
  89.     }
  90.  
  91.  
  92.  
  93.  
  94. /*
  95.  * CImpIOleInPlaceUIWindow::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 CImpIOleInPlaceUIWindow::ContextSensitiveHelp(
  106.     BOOL fEnterMode)
  107.     {
  108.     return NOERROR;
  109.     }
  110.  
  111.  
  112.  
  113.  
  114. /*
  115.  * CImpIOleInPlaceUIWindow::GetBorder
  116.  *
  117.  * Purpose:
  118.  *  Returns the rectangle in which the container is willing to
  119.  *  negotiate about an object's adornments.
  120.  *
  121.  * Parameters:
  122.  *  prcBorder       LPRECT in which to store the rectangle.
  123.  *
  124.  * Return Value:
  125.  *  HRESULT         NOERROR if all is well, INPLACE_E_NOTOOLSPACE
  126.  *                  if there is no negotiable space.
  127.  */
  128.  
  129. STDMETHODIMP CImpIOleInPlaceUIWindow::GetBorder(LPRECT prcBorder)
  130.     {
  131.     return NOERROR;
  132.     }
  133.  
  134.  
  135.  
  136.  
  137. /*
  138.  * CImpIOleInPlaceUIWindow::RequestBorderSpace
  139.  *
  140.  * Purpose:
  141.  *  Asks the container if it can surrender the amount of space
  142.  *  in pBW that the object would like for it's adornments.  The
  143.  *  container does nothing but validate the spaces on this call.
  144.  *
  145.  * Parameters:
  146.  *  pBW             LPCBORDERWIDTHS containing the requested space.
  147.  *                  The values are the amount of space requested
  148.  *                  from each side of the relevant window.
  149.  *
  150.  * Return Value:
  151.  *  HRESULT         NOERROR if we can give up space,
  152.  *                  INPLACE_E_NOTOOLSPACE otherwise.
  153.  */
  154.  
  155. STDMETHODIMP CImpIOleInPlaceUIWindow::RequestBorderSpace(
  156.     LPCBORDERWIDTHS pBW)
  157.     {
  158.     return NOERROR;
  159.     }
  160.  
  161.  
  162.  
  163.  
  164. /*
  165.  * CImpIOleInPlaceUIWindow::SetBorderSpace
  166.  *
  167.  * Purpose:
  168.  *  Called when the object now officially requests that the
  169.  *  container surrender border space it previously allowed in
  170.  *  RequestBorderSpace.  The container should resize windows
  171.  *  appropriately to surrender this space.
  172.  *
  173.  * Parameters:
  174.  *  pBW             LPCBORDERWIDTHS containing the amount of space
  175.  *                  from each side of the relevant window that the
  176.  *                  object is now reserving.
  177.  */
  178.  
  179. STDMETHODIMP CImpIOleInPlaceUIWindow::SetBorderSpace(
  180.     LPCBORDERWIDTHS pBW)
  181.     {
  182.     return NOERROR;
  183.     }
  184.  
  185.  
  186.  
  187.  
  188. /*
  189.  * CImpIOleInPlaceUIWindow::SetActiveObject
  190.  *
  191.  * Purpose:
  192.  *  Provides the container with the object's IOleInPlaceActiveObject
  193.  *  pointer and a name of the object to show in the container's
  194.  *  caption.
  195.  *
  196.  * Parameters:
  197.  *  pIIPActiveObj   LPOLEINPLACEACTIVEOBJECT of interest.
  198.  *  pszObj          LPCOLESTR to use in the container's caption bar.
  199.  */
  200.  
  201. STDMETHODIMP CImpIOleInPlaceUIWindow::SetActiveObject(
  202.     LPOLEINPLACEACTIVEOBJECT pIIPActiveObj, LPCOLESTR pszObj)
  203.     {
  204.     return NOERROR;
  205.     }
  206.