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

  1. /*
  2.  * IIPAOBJ.CPP
  3.  *
  4.  * Template IOleInPlaceActiveObject 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 "iipaobj.h"
  15.  
  16.  
  17. /*
  18.  * CImpIOleInPlaceActiveObject::CImpIOleInPlaceActiveObject
  19.  * CImpIOleInPlaceActiveObject::~CImpIOleInPlaceActiveObject
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIOleInPlaceActiveObject::CImpIOleInPlaceActiveObject(LPVOID pObj
  27.     , LPUNKNOWN pUnkOuter)
  28.     {
  29.     m_cRef=0;
  30.     m_pObj=pObj;
  31.     m_pUnkOuter=pUnkOuter;
  32.     return;
  33.     }
  34.  
  35. CImpIOleInPlaceActiveObject::~CImpIOleInPlaceActiveObject(void)
  36.     {
  37.     return;
  38.     }
  39.  
  40.  
  41.  
  42. /*
  43.  * CImpIOleInPlaceActiveObject::QueryInterface
  44.  * CImpIOleInPlaceActiveObject::AddRef
  45.  * CImpIOleInPlaceActiveObject::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIOleInPlaceActiveObject.
  49.  */
  50.  
  51. STDMETHODIMP CImpIOleInPlaceActiveObject::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIOleInPlaceActiveObject::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIOleInPlaceActiveObject::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71.  
  72. /*
  73.  * CImpIOleInPlaceActiveObject::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 CImpIOleInPlaceActiveObject::GetWindow(HWND *phWnd)
  87.     {
  88.     return ResultFromScode(E_FAIL);
  89.     }
  90.  
  91.  
  92.  
  93.  
  94. /*
  95.  * CImpIOleInPlaceActiveObject::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 CImpIOleInPlaceActiveObject::ContextSensitiveHelp(
  106.     BOOL fEnterMode)
  107.     {
  108.     return ResultFromScode(E_NOTIMPL);
  109.     }
  110.  
  111.  
  112.  
  113.  
  114. /*
  115.  * CImpIOleInPlaceActiveObject::TranslateAccelerator
  116.  *
  117.  * Purpose:
  118.  *  Requests that the active in-place object translate the message
  119.  *  given in pMSG if appropriate.  This is only called for DLL
  120.  *  servers where the container's message loop is running.  EXE servers
  121.  *  have control of the message loop so this will not be called in
  122.  *  such cases.
  123.  *
  124.  * Parameters:
  125.  *  pMSG            LPMSG to the message to translate.
  126.  *
  127.  * Return Value:
  128.  *  HRESULT         NOERROR if translates, S_FALSE if not.
  129.  */
  130.  
  131. STDMETHODIMP CImpIOleInPlaceActiveObject::TranslateAccelerator(
  132.     LPMSG pMSG)
  133.     {
  134.     return ResultFromScode(S_FALSE);
  135.     }
  136.  
  137.  
  138.  
  139.  
  140. /*
  141.  * CImpIOleInPlaceActiveObject::OnFrameWindowActivate
  142.  *
  143.  * Purpose:
  144.  *  Informs the in-place object that the container's frame window
  145.  *  was either activated or deactivated.
  146.  *
  147.  * Parameters:
  148.  *  fActivate       BOOL TRUE if frame is active, FALSE otherwise.
  149.  */
  150.  
  151. STDMETHODIMP CImpIOleInPlaceActiveObject::OnFrameWindowActivate(
  152.     BOOL fActivate)
  153.     {
  154.     return ResultFromScode(E_NOTIMPL);
  155.     }
  156.  
  157.  
  158.  
  159.  
  160. /*
  161.  * CImpIOleInPlaceActiveObject::OnDocWindowActivate
  162.  *
  163.  * Purpose:
  164.  *  Informs the in-place object that the document window in the
  165.  *  container is either becoming active or deactive.  On this call
  166.  *  the object must either add or remove frame-level tools,
  167.  *  including the mixed menu, depending on fActivate.
  168.  *
  169.  * Parameters:
  170.  *  fActivate       BOOL TRUE if document is active, FALSE otherwise
  171.  */
  172.  
  173. STDMETHODIMP CImpIOleInPlaceActiveObject::OnDocWindowActivate(
  174.     BOOL fActivate)
  175.     {
  176.     return ResultFromScode(E_NOTIMPL);
  177.     }
  178.  
  179.  
  180.  
  181.  
  182. /*
  183.  * CImpIOleInPlaceActiveObject::ResizeBorder
  184.  *
  185.  * Purpose:
  186.  *  Informs the object that the frame or document size changed in
  187.  *  which case the object may need to resize any of its frame or
  188.  *  document-level tools to match.
  189.  *
  190.  * Parameters:
  191.  *  pRect           LPCRECT indicating the new size of the window
  192.  *                  of interest.
  193.  *
  194.  *  pIUIWindow      LPOLEINPLACEUIWINDOW pointing to an
  195.  *                  IOleInPlaceUIWindow interface on the container
  196.  *                  object of interest.  We use this to do
  197.  *                  border-space negotiation.
  198.  *
  199.  *  fFrame          BOOL indicating if the frame was resized
  200.  *                  (TRUE) or the document (FALSE)
  201.  */
  202.  
  203. STDMETHODIMP CImpIOleInPlaceActiveObject::ResizeBorder(LPCRECT pRect
  204.     , LPOLEINPLACEUIWINDOW pIUIWindow, BOOL fFrame)
  205.     {
  206.     return ResultFromScode(E_NOTIMPL);
  207.     }
  208.  
  209.  
  210.  
  211.  
  212. /*
  213.  * CImpIOleInPlaceActiveObject::EnableModeless
  214.  *
  215.  * Purpose:
  216.  *  Instructs the object to show or hide any modeless popup windows
  217.  *  that it may be using when activated in-place.
  218.  *
  219.  * Parameters:
  220.  *  fEnable         BOOL indicating to enable/show the windows
  221.  *                  (TRUE) or to hide them (FALSE).
  222.  */
  223.  
  224. STDMETHODIMP CImpIOleInPlaceActiveObject::EnableModeless(
  225.     BOOL fActivate)
  226.     {
  227.     return ResultFromScode(E_NOTIMPL);
  228.     }
  229.