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.

156 lines
4.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1997 - 1999
  4. Module Name:
  5. LogCompD.cpp
  6. Abstract:
  7. The CLoggingComponentData class implements several interfaces which MMC uses:
  8. The IComponentData interface is basically how MMC talks to the snap-in
  9. to get it to implement the left-hand-side "scope" pane.
  10. The IExtendPropertySheet interface is how the snap-in adds property sheets
  11. for any of the items a user might click on.
  12. The IExtendContextMenu interface what we do to add custom entries
  13. to the menu which appears when a user right-clicks on a node.
  14. The IExtendControlBar interface allows us to support a custom
  15. iconic toolbar.
  16. See ComponentData.cpp for implementation.
  17. Note:
  18. Much of the functionality of this class is implemented in atlsnap.h
  19. by IComponentDataImpl. We are mostly overriding here.
  20. Revision History:
  21. mmaguire 11/6/97 - created using MMC snap-in wizard
  22. --*/
  23. //////////////////////////////////////////////////////////////////////////////
  24. #if !defined(_LOG_COMPONENT_DATA_H_)
  25. #define _LOG_COMPONENT_DATA_H_
  26. //////////////////////////////////////////////////////////////////////////////
  27. // BEGIN INCLUDES
  28. //
  29. // where we can find what this class derives from:
  30. //
  31. //Moved to Precompiled.h: #include <atlsnap.h>
  32. //
  33. //
  34. // where we can find what this class has or uses:
  35. //
  36. #include "LogMacNd.h"
  37. //
  38. // END INCLUDES
  39. //////////////////////////////////////////////////////////////////////////////
  40. //
  41. // hack start
  42. //
  43. // This is a big hack to work around a atlsnap.h bug: Atlsnap.h
  44. // can't support extending multiple nodes. So we basically just
  45. // copied EXTENSION_SNAPIN_NODEINFO_ENTRY() here. We need to change
  46. // this after the atlsnap.h fix -- MAM: 08-06-98 -- yeah right
  47. //
  48. //
  49. // The following statements are copied from atlsnap.h and then changed
  50. // to support multiple extending node
  51. //
  52. // IsSupportedGUID will also set the m_enumExtendedSnapin flag in side m_##dataClass object
  53. // which, in our case, is CLoggingMachineNode
  54. //
  55. #define EXTENSION_SNAPIN_NODEINFO_ENTRY_EX(dataClass) \
  56. if ( m_##dataClass.IsSupportedGUID( guid ) )\
  57. { \
  58. *ppItem = m_##dataClass.GetExtNodeObject(pDataObject, &m_##dataClass); \
  59. _ASSERTE(*ppItem != NULL); \
  60. (*ppItem)->InitDataClass(pDataObject, &m_##dataClass); \
  61. return hr; \
  62. }
  63. //
  64. // hack end
  65. //
  66. class CLoggingComponent;
  67. class CLoggingComponentData :
  68. public CComObjectRootEx<CComSingleThreadModel>
  69. , public CSnapInObjectRoot<1, CLoggingComponentData>
  70. , public IComponentDataImpl<CLoggingComponentData, CLoggingComponent>
  71. , public IExtendPropertySheetImpl<CLoggingComponentData>
  72. , public IExtendContextMenuImpl<CLoggingComponentData>
  73. , public IExtendControlbarImpl<CLoggingComponentData>
  74. , public ISnapinHelp
  75. , public CComCoClass<CLoggingComponentData, &CLSID_LoggingSnapin>
  76. {
  77. public:
  78. CLoggingComponentData();
  79. ~CLoggingComponentData();
  80. EXTENSION_SNAPIN_DATACLASS(CLoggingMachineNode)
  81. BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP(CLoggingComponentData)
  82. EXTENSION_SNAPIN_NODEINFO_ENTRY_EX(CLoggingMachineNode)
  83. END_EXTENSION_SNAPIN_NODEINFO_MAP()
  84. BEGIN_COM_MAP(CLoggingComponentData)
  85. COM_INTERFACE_ENTRY(IComponentData)
  86. COM_INTERFACE_ENTRY(IExtendPropertySheet2)
  87. COM_INTERFACE_ENTRY(IExtendContextMenu)
  88. COM_INTERFACE_ENTRY(IExtendControlbar)
  89. COM_INTERFACE_ENTRY(ISnapinHelp)
  90. END_COM_MAP()
  91. DECLARE_REGISTRY_RESOURCEID(IDR_NAPSNAPIN)
  92. DECLARE_NOT_AGGREGATABLE(CLoggingComponentData)
  93. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  94. STDMETHOD(CompareObjects)(
  95. LPDATAOBJECT lpDataObjectA
  96. , LPDATAOBJECT lpDataObjectB
  97. );
  98. STDMETHOD(CreateComponent)(LPCOMPONENT *ppComponent);
  99. // ISnapinHelp method(s)
  100. STDMETHOD(GetHelpTopic)(LPOLESTR * lpCompiledHelpFile)
  101. {return E_UNEXPECTED;};
  102. // We are overiding ATLsnap.h's IComponentImpl implementation of this
  103. // in order to correctly handle messages which it is incorrectly
  104. // ignoring (e.g. MMCN_COLUMN_CLICK and MMCN_SNAPINHELP)
  105. STDMETHOD(Notify)(
  106. LPDATAOBJECT lpDataObject
  107. , MMC_NOTIFY_TYPE event
  108. , LPARAM arg
  109. , LPARAM param
  110. );
  111. virtual HRESULT OnPropertyChange(
  112. LPARAM arg
  113. , LPARAM param
  114. );
  115. };
  116. #endif // _LOG_COMPONENT_DATA_H_