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.

96 lines
2.8 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) 1995-1996 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. #ifndef _DATAOBJ_H
  9. #define _DATAOBJ_H
  10. class CDataObject : public IDataObject, public CComObjectRoot
  11. {
  12. friend class CSnapin;
  13. // ATL Maps
  14. DECLARE_NOT_AGGREGATABLE(CDataObject)
  15. BEGIN_COM_MAP(CDataObject)
  16. COM_INTERFACE_ENTRY(IDataObject)
  17. END_COM_MAP()
  18. // Construction/Destruction
  19. CDataObject() {};
  20. ~CDataObject() {};
  21. // Clipboard formats that are required by the console
  22. public:
  23. static unsigned int m_cfNodeType;
  24. static unsigned int m_cfNodeTypeString;
  25. static unsigned int m_cfDisplayName;
  26. static unsigned int m_cfCoClass;
  27. static unsigned int m_cfInternal; // Step 3
  28. // Standard IDataObject methods
  29. public:
  30. // Implemented
  31. STDMETHOD(GetData)(LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium);
  32. STDMETHOD(GetDataHere)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium);
  33. STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc);
  34. ULONG InternalAddRef()
  35. {
  36. ++CSnapin::lDataObjectRefCount;
  37. return CComObjectRoot::InternalAddRef();
  38. }
  39. ULONG InternalRelease()
  40. {
  41. --CSnapin::lDataObjectRefCount;
  42. return CComObjectRoot::InternalRelease();
  43. }
  44. // Not Implemented
  45. private:
  46. STDMETHOD(QueryGetData)(LPFORMATETC lpFormatetc)
  47. { return E_NOTIMPL; };
  48. STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
  49. { return E_NOTIMPL; };
  50. STDMETHOD(SetData)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
  51. { return E_NOTIMPL; };
  52. STDMETHOD(DAdvise)(LPFORMATETC lpFormatetc, DWORD advf,
  53. LPADVISESINK pAdvSink, LPDWORD pdwConnection)
  54. { return E_NOTIMPL; };
  55. STDMETHOD(DUnadvise)(DWORD dwConnection)
  56. { return E_NOTIMPL; };
  57. STDMETHOD(EnumDAdvise)(LPENUMSTATDATA* ppEnumAdvise)
  58. { return E_NOTIMPL; };
  59. // Implementation
  60. public:
  61. void SetType(DATA_OBJECT_TYPES type) // Step 3
  62. { ASSERT(m_internal.m_type == CCT_UNINITIALIZED); m_internal.m_type = type; }
  63. void SetCookie(long cookie) { m_internal.m_cookie = cookie; } // Step 3
  64. void SetString(LPTSTR lpString) { m_internal.m_string = lpString; }
  65. BOOL m_fMachine;
  66. private:
  67. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  68. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  69. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  70. HRESULT CreateCoClassID(LPSTGMEDIUM lpMedium);
  71. HRESULT CreateInternal(LPSTGMEDIUM lpMedium); // Step 3
  72. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  73. INTERNAL m_internal; // Step 3
  74. };
  75. #endif