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

  1. /*
  2.  * OleCntrl.cpp
  3.  * $Header: /bcsample/IFACEDLL/OLECNTRL.CPP 1     5/28/96 1:12p Dave $
  4.  *
  5.  * Description:
  6.  *  This file provides the test-implementation of the IOleControl 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 "olecntrl.h"
  27.  
  28. CIOleControl :: CIOleControl ( LPUNKNOWN  pUnkOuter , PCIUnknown pMainIUnk )
  29. {
  30.     m_cRef = 0 ;
  31.     m_pUnkOuter = pUnkOuter ;
  32.     m_pBaseUnk = pMainIUnk ;
  33. }
  34.  
  35. CIOleControl :: ~CIOleControl ( void )
  36. {
  37. }
  38.  
  39. BOOL CIOleControl :: Init ( void )
  40. {
  41.     return ( TRUE ) ;
  42. }
  43.  
  44. STDMETHODIMP_( ULONG ) CIOleControl :: AddRef ( void )
  45. {
  46.     return ( m_pBaseUnk->AddRef( ) ) ;
  47. }
  48.  
  49. STDMETHODIMP_( ULONG ) CIOleControl :: Release ( void )
  50. {
  51.     return ( m_pBaseUnk->Release( ) ) ;
  52. }
  53.  
  54. STDMETHODIMP CIOleControl :: QueryInterface ( REFIID riid ,
  55.                                                     PPVOID ppv   )
  56. {
  57.     *ppv = NULL ;
  58.  
  59.     if ( IID_IOleControl == riid )
  60.     {
  61.         *ppv = ( IOleControl* )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 CIOleControl :: 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_IOleControl == riid )
  80.     {
  81.         *ppv = (IOleControl*)this ;
  82.         return ( NOERROR ) ;
  83.     }
  84.     return ( E_NOINTERFACE ) ;
  85. }
  86.  
  87.  
  88. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  89. // Place all interface functions here!!
  90.  
  91. HRESULT __stdcall CIOleControl :: GetControlInfo ( LPCONTROLINFO pCI ) 
  92. {
  93.     return ( S_OK ) ;
  94. }    
  95.  
  96. HRESULT __stdcall CIOleControl :: OnMnemonic ( LPMSG pMsg ) 
  97. {
  98.     return ( S_OK ) ;
  99. }    
  100.  
  101. HRESULT __stdcall CIOleControl :: OnAmbientPropertyChange ( DISPID dispid ) 
  102. {
  103.     return ( S_OK ) ;
  104. }    
  105.  
  106. HRESULT __stdcall CIOleControl :: FreezeEvents ( BOOL bFreeze ) 
  107. {
  108.     return ( S_OK ) ;
  109. }    
  110.  
  111.