Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.5 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1996 Microsoft Corporation. All Rights Reserved.
  5. Component: IDispatch implementation
  6. File: Dispatch.h
  7. Owner: DGottner
  8. This file contains our implementation of IDispatch
  9. ===================================================================*/
  10. #ifndef _Dispatch_H
  11. #define _Dispatch_H
  12. /*
  13. * C D i s p a t c h
  14. *
  15. * IDispatch interface implementation for OLE objects
  16. *
  17. * This class contains the basic four IDispatch members. The Big Three
  18. * (QueryInterface, AddRef, Release) are left as pure virtual, as this
  19. * class is designed as an intermediate class for further derivation.
  20. *
  21. * This also means that we no longer need a pointer to the controlling unknown.
  22. */
  23. class CDispatch : public IDispatch
  24. {
  25. private:
  26. const GUID * m_pGuidDispInterface;
  27. ITypeLib * m_pITypeLib;
  28. ITypeInfo * m_pITINeutral;
  29. public:
  30. CDispatch();
  31. ~CDispatch();
  32. // Do this in Init because OLE interfaces in general do not take
  33. // parameters in the constructor. This call CANNOT fail, however.
  34. //
  35. void Init(const IID &GuidDispInterface, const ITypeLib *pITypeLib = NULL);
  36. void SetTypeLib(ITypeLib *);
  37. // IDispatch members
  38. //
  39. STDMETHODIMP GetTypeInfoCount(UINT *);
  40. STDMETHODIMP GetTypeInfo(UINT, LCID, ITypeInfo **);
  41. STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR **, UINT, LCID, DISPID *);
  42. STDMETHODIMP Invoke(DISPID, REFIID, LCID, WORD,
  43. DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
  44. };
  45. inline void CDispatch::SetTypeLib(ITypeLib *pITypeLib) { m_pITypeLib = pITypeLib; return; };
  46. /*
  47. * C S u p p o r t E r r o r I n f o
  48. *
  49. * Implemention of ISupportErrorInfo for Denali classes
  50. */
  51. class CSupportErrorInfo : public ISupportErrorInfo
  52. {
  53. private:
  54. IUnknown * m_pUnkObj;
  55. IUnknown * m_pUnkOuter;
  56. const GUID *m_pGuidDispInterface;
  57. public:
  58. CSupportErrorInfo(void);
  59. CSupportErrorInfo(IUnknown *pUnkObj, IUnknown *pUnkOuter, const IID &GuidDispInterface);
  60. void Init(IUnknown *pUnkObj, IUnknown *pUnkOuter, const GUID &GuidDispInterface);
  61. // IUnknown members that delegate to m_pUnkOuter.
  62. //
  63. STDMETHODIMP QueryInterface(REFIID, void **);
  64. STDMETHODIMP_(ULONG) AddRef(void);
  65. STDMETHODIMP_(ULONG) Release(void);
  66. // ISupportErrorInfo members
  67. //
  68. STDMETHODIMP InterfaceSupportsErrorInfo(REFIID);
  69. };
  70. extern void Exception(REFIID ObjID, LPOLESTR strSource, LPOLESTR strDescr);
  71. extern void ExceptionId(REFIID ObjID, UINT SourceID, UINT DescrID, HRESULT hrCode = S_OK);
  72. #endif /* _Dispatch_H */