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.

141 lines
4.2 KiB

  1. // cmponent.h : Declaration of CMyComputerComponent
  2. #ifndef __CMPONENT_H_INCLUDED__
  3. #define __CMPONENT_H_INCLUDED__
  4. #include "stdcmpnt.h" // CComponent
  5. #include "cookie.h" // CMyComputerCookie
  6. #include "persist.h" // PersistStream
  7. // forward declarations
  8. class CMyComputerComponentData;
  9. class CMyComputerComponent :
  10. public CComponent
  11. , public IMyComputer
  12. , public IExtendContextMenu
  13. , public PersistStream
  14. {
  15. public:
  16. CMyComputerComponent();
  17. virtual ~CMyComputerComponent();
  18. BEGIN_COM_MAP(CMyComputerComponent)
  19. COM_INTERFACE_ENTRY(IMyComputer)
  20. COM_INTERFACE_ENTRY(IExtendContextMenu)
  21. COM_INTERFACE_ENTRY(IPersistStream)
  22. COM_INTERFACE_ENTRY_CHAIN(CComponent)
  23. END_COM_MAP()
  24. #if DBG==1
  25. ULONG InternalAddRef()
  26. {
  27. return CComObjectRoot::InternalAddRef();
  28. }
  29. ULONG InternalRelease()
  30. {
  31. return CComObjectRoot::InternalRelease();
  32. }
  33. int dbg_InstID;
  34. #endif // DBG==1
  35. // IFileServiceMgmt
  36. // IComponent implemented in CComponent
  37. HRESULT OnViewChange (LPDATAOBJECT pDataObject, LPARAM data, LPARAM hint);
  38. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, LPOLESTR* ppViewType, long* pViewOptions);
  39. // IExtendContextMenu
  40. STDMETHOD(AddMenuItems)(
  41. IDataObject* piDataObject,
  42. IContextMenuCallback* piCallback,
  43. long* pInsertionAllowed);
  44. STDMETHOD(Command)(
  45. LONG lCommandID,
  46. IDataObject* piDataObject );
  47. void ExpandAndSelect( MyComputerObjectType objecttype );
  48. void LaunchWelcomeApp();
  49. // IPersistStream
  50. HRESULT STDMETHODCALLTYPE GetClassID(CLSID __RPC_FAR *pClassID)
  51. {
  52. *pClassID=CLSID_MyComputer;
  53. return S_OK;
  54. }
  55. HRESULT STDMETHODCALLTYPE Load(IStream __RPC_FAR *pStg);
  56. HRESULT STDMETHODCALLTYPE Save(IStream __RPC_FAR *pStgSave, BOOL fSameAsLoad);
  57. // support methods for IComponent
  58. virtual HRESULT OnNotifySelect( LPDATAOBJECT lpDataObject, BOOL fSelected );
  59. virtual HRESULT ReleaseAll();
  60. virtual HRESULT Show(CCookie* pcookie, LPARAM arg, HSCOPEITEM hScopeItem);
  61. virtual HRESULT OnNotifyAddImages( LPDATAOBJECT lpDataObject,
  62. LPIMAGELIST lpImageList,
  63. HSCOPEITEM hSelectedItem );
  64. virtual HRESULT OnNotifySnapinHelp (LPDATAOBJECT pDataObject);
  65. HRESULT PopulateListbox(CMyComputerCookie* pcookie);
  66. // HRESULT PopulateServices(CMyComputerCookie* pcookie);
  67. // HRESULT AddServiceItems(CMyComputerCookie* pParentCookie, ENUM_SERVICE_STATUS * rgESS, DWORD nDataItems);
  68. // HRESULT EnumerateScopeChildren(CMyComputerCookie* pParentCookie, HSCOPEITEM hParent);
  69. // HRESULT LoadIcons();
  70. static HRESULT LoadStrings();
  71. HRESULT LoadColumns( CMyComputerCookie* pcookie );
  72. // support methods for IPersistStream
  73. enum // Bit fields for m_dwFlagsPersist
  74. {
  75. // mskfFirst = 0x0001
  76. };
  77. DWORD m_dwFlagsPersist; // General-purpose flags to be persisted into .msc file
  78. void SetPersistentFlags(DWORD dwFlags)
  79. {
  80. m_dwFlagsPersist = dwFlags;
  81. }
  82. DWORD GetPersistentFlags()
  83. {
  84. return m_dwFlagsPersist;
  85. }
  86. CMyComputerComponentData& QueryComponentDataRef()
  87. {
  88. return (CMyComputerComponentData&)QueryBaseComponentDataRef();
  89. }
  90. public:
  91. LPCONTROLBAR m_pControlbar; // CODEWORK should use smartpointer
  92. LPTOOLBAR m_pSvcMgmtToolbar; // CODEWORK should use smartpointer
  93. LPTOOLBAR m_pMyComputerToolbar; // CODEWORK should use smartpointer
  94. CMyComputerCookie* m_pViewedCookie; // CODEWORK I hate to have to do this...
  95. static const GUID m_ObjectTypeGUIDs[MYCOMPUT_NUMTYPES];
  96. static const BSTR m_ObjectTypeStrings[MYCOMPUT_NUMTYPES];
  97. private:
  98. bool m_bForcingGetResultType;
  99. }; // class CMyComputerComponent
  100. // Enumeration for the icons used
  101. enum
  102. {
  103. iIconComputer = 0, // Root of the snapin
  104. iIconComputerFail, // Root of the snapin when we cannot connect to the computer
  105. iIconSystemTools, // System Tools
  106. iIconStorage, // Storage
  107. iIconServerApps, // Server Applications
  108. iIconLast // Must be last
  109. };
  110. typedef enum _COLNUM_COMPUTER {
  111. COLNUM_COMPUTER_NAME = 0
  112. } COLNUM_ROOT;
  113. HRESULT LoadIconsIntoImageList(LPIMAGELIST pImageList, BOOL fLoadLargeIcons);
  114. #endif // ~__CMPONENT_H_INCLUDED__