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.

151 lines
5.5 KiB

  1. /*======================================================================================//
  2. | Process Control //
  3. | //
  4. |Copyright (c) 1998 Sequent Computer Systems, Incorporated. All rights reserved. //
  5. | //
  6. |File Name: DataObj.h //
  7. | //
  8. |Description: Class definition for CDataObj, implements IDataObj interface //
  9. | //
  10. |Created: Paul Skoglund 07-1998 //
  11. | //
  12. |Rev History: //
  13. | //
  14. |=======================================================================================*/
  15. /////////////////////////////////////////////////////////////////////////////
  16. // DataObj: The IDataObject Interface is used to communicate data
  17. //
  18. // This is a part of the MMC SDK.
  19. // Copyright (C) 1997 Microsoft Corporation
  20. // All rights reserved.
  21. //
  22. // This source code is only intended as a supplement to the
  23. // MMC SDK Reference and related
  24. // electronic documentation provided with the library.
  25. // See these sources for detailed information regarding the
  26. // MMC Library product.
  27. //
  28. #ifndef __DATAOBJ_H_
  29. #define __DATAOBJ_H_
  30. #include <atlctl.h>
  31. #include <mmc.h>
  32. #include "Globals.h"
  33. // Custom clipboard formats
  34. const TCHAR *const CCF_SNAPIN_INTERNAL = _T("CF_PROCCON_DATAOBJECT_CONTAINER");
  35. const TCHAR *const CCF_SNAPIN_BASEINTERNAL = _T("CF_PROCCON_BASENODEOBJECT_CONTAINER");
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Defines, Types etc...
  38. //
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CDataObject - This class is used to pass data back and forth with MMC. It
  41. // uses a standard interface, IDataObject to acomplish this.
  42. // Refer to OLE documentation for a description of clipboard
  43. // formats and the IDataObject interface.
  44. class CDataObject:
  45. //public IDataObjectImpl<CDataObject>,
  46. public IDataObject,
  47. public CComObjectRoot
  48. {
  49. public:
  50. DECLARE_NOT_AGGREGATABLE(CDataObject)
  51. BEGIN_COM_MAP(CDataObject)
  52. COM_INTERFACE_ENTRY(IDataObject)
  53. END_COM_MAP()
  54. CDataObject();
  55. ~CDataObject();
  56. // IDataObject methods
  57. public:
  58. STDMETHOD(GetDataHere)(FORMATETC *pformatetc, STGMEDIUM *pmedium);
  59. STDMETHOD(EnumFormatEtc)( DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc );
  60. STDMETHOD(GetData)(LPFORMATETC pFormatEtc, LPSTGMEDIUM pStgMedium);
  61. STDMETHOD(QueryGetData)(LPFORMATETC pFormatEtc);
  62. STDMETHOD(SetData)(LPFORMATETC pFormatEtc, LPSTGMEDIUM pStgMedium, BOOL bRelease);
  63. // The rest are not implemented
  64. STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
  65. {
  66. return E_NOTIMPL;
  67. };
  68. STDMETHOD(DAdvise)(LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
  69. {
  70. return E_NOTIMPL;
  71. };
  72. STDMETHOD(DUnadvise)(DWORD dwConnection)
  73. {
  74. return E_NOTIMPL;
  75. };
  76. STDMETHOD(EnumDAdvise)(LPENUMSTATDATA* ppEnumAdvise)
  77. {
  78. return E_NOTIMPL;
  79. };
  80. // Non-interface member functions
  81. public:
  82. DATA_OBJECT_TYPES GetContext() { return m_Context; }
  83. MMC_COOKIE GetResultItemCookie() { ASSERT(m_bResultItem); return m_Cookie; }
  84. CBaseNode *GetBaseObject() { ASSERT(m_pFolderObj); return m_pFolderObj; }
  85. BOOL IsResultItem() { return m_bResultItem; }
  86. VOID SetDataObject(DATA_OBJECT_TYPES, CBaseNode *pFolder );
  87. VOID SetDataObject(DATA_OBJECT_TYPES, CBaseNode *pFolder, MMC_COOKIE ResultItemCookie);
  88. private:
  89. HRESULT WriteNodeID (IStream *pstm, BOOL bCCF_NODEID = FALSE );
  90. HRESULT WriteSnapinPreloads(IStream *pstm);
  91. HRESULT WriteWindowTitle (IStream* pstm);
  92. HRESULT WriteNodeTypeGUID (IStream *pstm);
  93. HRESULT WriteNodeTypeGUIDString(IStream *pstm);
  94. HRESULT WriteDisplayName (IStream *pstm);
  95. HRESULT WriteClsid (IStream *pstm);
  96. HRESULT WriteInternal (IStream *pstm);
  97. HRESULT WriteBaseInternal (IStream *pstm);
  98. DATA_OBJECT_TYPES m_Context; // Context in which this was created
  99. CBaseNode * m_pFolderObj; // Pointer to a folder object
  100. MMC_COOKIE m_Cookie; // result item LPARAM cookie or index
  101. BOOL m_bResultItem; // dataobject pointer for a result item...
  102. public:
  103. static LONG s_nCount;
  104. // not required, but used by MMC formats:
  105. static UINT s_cfNodeID;
  106. static UINT s_cfNodeID2;
  107. static UINT s_cfSnapinPreloads;
  108. static UINT s_cfWindowTitle;
  109. // required formats:
  110. static UINT s_cfNodeType;
  111. static UINT s_cfNodeTypeString;
  112. static UINT s_cfDisplayName;
  113. static UINT s_cfSnapinClsid;
  114. // custom formats:
  115. static UINT s_cfInternal; // Our custom clipboard format
  116. static UINT s_cfBaseInternal; // Our custom clipboard format
  117. };
  118. #endif // __DATAOBJ_H_