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 / idispat.cpp < prev    next >
C/C++ Source or Header  |  1996-05-21  |  4KB  |  168 lines

  1. /*
  2.  * IDISPAT.CPP
  3.  *
  4.  * Template IDispatch 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 "idispat.h"
  15.  
  16.  
  17. /*
  18.  * CImpIDispatch::CImpIDispatch
  19.  * CImpIDispatch::~CImpIDispatch
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIDispatch::CImpIDispatch(LPVOID pObj
  27.     , LPUNKNOWN pUnkOuter)
  28.     {
  29.     m_cRef=0;
  30.     m_pObj=pObj;
  31.     m_pUnkOuter=pUnkOuter;
  32.     return;
  33.     }
  34.  
  35. CImpIDispatch::~CImpIDispatch(void)
  36.     {
  37.     return;
  38.     }
  39.  
  40.  
  41.  
  42. /*
  43.  * CImpIDispatch::QueryInterface
  44.  * CImpIDispatch::AddRef
  45.  * CImpIDispatch::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIDispatch.
  49.  */
  50.  
  51. STDMETHODIMP CImpIDispatch::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIDispatch::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIDispatch::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71.  
  72. /*
  73.  * CImpIDispatch::GetTypeInfoCount
  74.  *
  75.  * Purpose:
  76.  *  Returns the number of tyep information (ITypeInfo) interfaces
  77.  *  that the object provides (0 or 1).
  78.  *
  79.  * Parameters:
  80.  *  pctInfo         UINT * to the location to receive
  81.  *                  the count of interfaces.
  82.  */
  83.  
  84. STDMETHODIMP CImpIDispatch::GetTypeInfoCount(UINT *pctInfo)
  85.     {
  86.     return ResultFromScode(E_NOTIMPL);
  87.     }
  88.  
  89.  
  90.  
  91.  
  92. /*
  93.  * CImpIDispatch::GetTypeInfo
  94.  *
  95.  * Purpose:
  96.  *  Retrieves type information for the automation interface.
  97.  *
  98.  * Parameters:
  99.  *  itinfo          UINT reserved.  Must be zero.
  100.  *  lcid            LCID providing the locale for the type
  101.  *                  information.  If the object does not support
  102.  *                  localization, this is ignored.
  103.  *  pptinfo         ITypeInfo ** in which to store the ITypeInfo
  104.  *                  interface for the object.
  105.  */
  106.  
  107. STDMETHODIMP CImpIDispatch::GetTypeInfo(UINT itinfo
  108.     , LCID lcid, ITypeInfo **pptInfo)
  109.     {
  110.     return ResultFromScode(E_NOTIMPL);
  111.     }
  112.  
  113.  
  114.  
  115.  
  116.  
  117. /*
  118.  * CImpIDispatch::GetIDsOfNames
  119.  *
  120.  * Purpose:
  121.  *
  122.  * Parameters:
  123.  *  riid            REFIID reserved.  Must be NULL.
  124.  *  rgszNames       OLECHAR ** pointing to the array of names to b
  125.  *                  mapped.
  126.  *  cNames          UINT number of names to be mapped.
  127.  *  lcid            LCID of the locale.
  128.  *  rgDispID        DISPID * caller allocated array containing IDs
  129.  *                  corresponginf to those names in rgszNames.
  130.  */
  131.  
  132. STDMETHODIMP CImpIDispatch::GetIDsOfNames(REFIID riid
  133.     , OLECHAR **rgszNames, UINT cNames, LCID lcid
  134.     , DISPID *rgDispID)
  135.     {
  136.     return ResultFromScode(E_NOTIMPL);
  137.     }
  138.  
  139.  
  140.  
  141.  
  142. /*
  143.  * CImpIDispatch::Invoke
  144.  *
  145.  * Purpose:
  146.  *
  147.  * Parameters:
  148.  *  dispIDMember    DISPID of the method to invoke.
  149.  *  riid            REFIID reserved, must be NULL.
  150.  *  lcid            LCID of the locale.
  151.  *  wFlags          USHORT describing the context of the invocation.
  152.  *  pDispParams     DISPPARAMS * to the array of arguments.
  153.  *  pVarResult      VARIANT * in which to store the result.  Is
  154.  *                  NULL if the caller is not interested.
  155.  *  pExcepInfo      EXCEPINFO * to exception information.
  156.  *  puArgErr        UINT * in which to store the index of an
  157.  *                  invalid parameter if DISP_E_TYPEMISMATCH
  158.  *                  is returned.
  159.  */
  160.  
  161. STDMETHODIMP CImpIDispatch::Invoke(DISPID disIDMember, REFIID riid
  162.     , LCID lcid, unsigned short wFlags, DISPPARAMS *pDispParams
  163.     , VARIANT *pVarResult, EXCEPINFO *pExcepInfo
  164.     , UINT *puArgErr)
  165.     {
  166.     return ResultFromScode(E_NOTIMPL);
  167.     }
  168.