Leaked source code of windows server 2003
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.

147 lines
4.0 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. iconnpt.h
  5. Abstract:
  6. Header file for connection points.
  7. --*/
  8. #ifndef _ICONNPT_H_
  9. #define _ICONNPT_H_
  10. // Event types
  11. // These values match the ID's in smonctrl.odl
  12. enum {
  13. eEventOnCounterSelected=1,
  14. eEventOnCounterAdded=2,
  15. eEventOnCounterDeleted=3,
  16. eEventOnSampleCollected=4,
  17. eEventOnDblClick=5
  18. };
  19. // Connection Point Types
  20. enum {
  21. eConnectionPointDirect=0,
  22. eConnectionPointDispatch=1
  23. };
  24. #define CONNECTION_POINT_CNT 2
  25. // Connection Point Class
  26. class CImpIConnectionPoint : public IConnectionPoint {
  27. public:
  28. CImpIConnectionPoint(void);
  29. ~CImpIConnectionPoint(void);
  30. //IUnknown members
  31. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  32. STDMETHODIMP_(ULONG) AddRef(void);
  33. STDMETHODIMP_(ULONG) Release(void);
  34. //IConnectionPoint members
  35. STDMETHODIMP GetConnectionInterface(IID *);
  36. STDMETHODIMP GetConnectionPointContainer (IConnectionPointContainer **);
  37. STDMETHODIMP Advise(LPUNKNOWN, DWORD *);
  38. STDMETHODIMP Unadvise(DWORD);
  39. STDMETHODIMP EnumConnections(IEnumConnections **);
  40. //Members not exposed by IConnectionPoint
  41. BOOL Init(PCPolyline pObj, LPUNKNOWN PUnkOuter, INT iConnPtType);
  42. void SendEvent(UINT uEventType, DWORD dwParam); // Send event to sink
  43. private:
  44. enum IConnPtConstant {
  45. eAdviseKey = 1234,
  46. eEventSinkWaitInterval = 2000
  47. };
  48. DWORD InitEventSinkLock ( void );
  49. void DeinitEventSinkLock ( void );
  50. BOOL EnterSendEvent ( void );
  51. void ExitSendEvent ( void );
  52. void EnterUnadvise ( void );
  53. void ExitUnadvise ( void );
  54. ULONG m_cRef; //Object reference count
  55. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  56. PCPolyline m_pObj; //Containing object
  57. INT m_iConnPtType; // Direct or dispatch connection
  58. HANDLE m_hEventEventSink;
  59. LONG m_lUnadviseRefCount;
  60. LONG m_lSendEventRefCount;
  61. union {
  62. IDispatch *pIDispatch; // Outgoing interface
  63. ISystemMonitorEvents *pIDirect;
  64. } m_Connection;
  65. };
  66. typedef CImpIConnectionPoint *PCImpIConnectionPoint;
  67. // Connection Point Container Class
  68. class CImpIConnPtCont : public IConnectionPointContainer
  69. {
  70. public:
  71. CImpIConnPtCont(PCPolyline, LPUNKNOWN);
  72. ~CImpIConnPtCont(void);
  73. //IUnknown members
  74. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  75. STDMETHODIMP_(DWORD) AddRef(void);
  76. STDMETHODIMP_(DWORD) Release(void);
  77. //IConnectionPointContainer members
  78. STDMETHODIMP EnumConnectionPoints(IEnumConnectionPoints **);
  79. STDMETHODIMP FindConnectionPoint(REFIID, IConnectionPoint **);
  80. private:
  81. ULONG m_cRef; //Interface ref count
  82. PCPolyline m_pObj; //Back pointer to object
  83. LPUNKNOWN m_pUnkOuter; //Controlling unknown
  84. };
  85. typedef CImpIConnPtCont *PCImpIConnPtCont;
  86. // Connection Point Enumerator Class
  87. class CImpIEnumConnPt : public IEnumConnectionPoints
  88. {
  89. protected:
  90. CImpIConnPtCont *m_pConnPtCont;
  91. DWORD m_cRef;
  92. ULONG m_cItems;
  93. ULONG m_uCurrent;
  94. const IID **m_apIID;
  95. public:
  96. CImpIEnumConnPt (CImpIConnPtCont *pConnPtCont, const IID **apIID, ULONG cItems);
  97. // IUnknown methods
  98. STDMETHOD(QueryInterface) (REFIID riid, LPVOID *ppvObj);
  99. STDMETHOD_(ULONG, AddRef) ();
  100. STDMETHOD_(ULONG, Release) ();
  101. // Enum methods
  102. STDMETHOD(Next) (ULONG cItems, IConnectionPoint **apConnPt, ULONG *pcReturned);
  103. STDMETHOD(Skip) (ULONG cSkip);
  104. STDMETHOD(Reset) (VOID);
  105. STDMETHOD(Clone) (IEnumConnectionPoints **pIEnum);
  106. };
  107. #endif //_ICONNPT_H_