home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / numega / sc501.exe / data1.cab / Examples / OLEWND.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  2.4 KB  |  103 lines

  1. /*
  2.  * OleWnd.cpp
  3.  * $Header: /bcsample/IFACEDLL/OLEWND.CPP 1     5/28/96 1:12p Dave $
  4.  *
  5.  * Description:
  6.  *  This file provides the test-implementation of the IOleWindow interface.
  7.  *
  8.  * Notes:
  9.  *  <implementation notes go here>
  10.  *
  11.  ***********************************************************************
  12.  *
  13.  * NuMega Technologies, Inc.
  14.  * P.O. Box 7780
  15.  * Nashua, NH 03060
  16.  *
  17.  * (c) Copyright 1994, 1995, 1996 NuMega Technologies, Inc.
  18.  * ALL RIGHTS RESERVED.
  19.  *
  20.  ***********************************************************************
  21.  *
  22.  **********************************************************************/
  23.  
  24.  
  25. #include "IFT_OLE.h"
  26. #include "OleWnd.h"
  27.  
  28. CIOleWindow :: CIOleWindow ( LPUNKNOWN  pUnkOuter , PCIUnknown pMainIUnk )
  29. {
  30.     m_cRef = 0 ;
  31.     m_pUnkOuter = pUnkOuter ;
  32.     m_pBaseUnk = pMainIUnk ;
  33. }
  34.  
  35. CIOleWindow :: ~CIOleWindow ( void )
  36. {
  37. }
  38.  
  39. BOOL CIOleWindow :: Init ( void )
  40. {
  41.     return ( TRUE ) ;
  42. }
  43.  
  44. STDMETHODIMP_( ULONG ) CIOleWindow :: AddRef ( void )
  45. {
  46.     return ( m_pBaseUnk->AddRef( ) ) ;
  47. }
  48.  
  49. STDMETHODIMP_( ULONG ) CIOleWindow :: Release ( void )
  50. {
  51.     return ( m_pBaseUnk->Release( ) ) ;
  52. }
  53.  
  54. STDMETHODIMP CIOleWindow :: QueryInterface ( REFIID riid ,
  55.                                                     PPVOID ppv   )
  56. {
  57.     *ppv = NULL ;
  58.  
  59.     if ( IID_IOleWindow == riid )
  60.     {
  61.         *ppv = ( IOleWindow* ) this ;
  62.         ( ( LPUNKNOWN ) *ppv)->AddRef ( ) ;
  63.         return ( NOERROR ) ;
  64.     }
  65.     else
  66.     {
  67.         // We just defer any other calls to the base IUnknown.
  68.         return ( m_pBaseUnk->QueryInterface ( riid , ppv ) ) ;
  69.     }
  70. }
  71.  
  72. STDMETHODIMP CIOleWindow :: InternalQueryInterface ( REFIID riid ,
  73.                                                         PPVOID ppv   )
  74. {
  75.     // Always set the interface memory location to NULL.
  76.     *ppv = NULL ;
  77.  
  78.     // If this ID is ours, then return ourselves.
  79.     if ( IID_IOleWindow == riid )
  80.     {
  81.         *ppv = ( IOleWindow* )this ;
  82.         return ( NOERROR ) ;
  83.     }
  84.     return ( E_NOINTERFACE ) ;
  85. }
  86.  
  87.  
  88. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  89. // Place all interface functions here!!
  90.  
  91. HRESULT __stdcall CIOleWindow :: GetWindow ( HWND __RPC_FAR *phwnd )
  92. {
  93.     return ( S_OK ) ;
  94.     
  95. }
  96.     
  97. HRESULT __stdcall CIOleWindow :: ContextSensitiveHelp ( BOOL fEnterMode )
  98. {
  99.     return ( S_OK ) ;
  100.     
  101. }
  102.     
  103.