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.

102 lines
3.0 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1998.
  5. //
  6. // File: dataobj.h
  7. //
  8. // Contents: implementation of IDataObject for the snapin objects
  9. //
  10. // Classes: CDataObject
  11. //
  12. // History: 03-17-1998 stevebl Created
  13. //
  14. //---------------------------------------------------------------------------
  15. #ifndef _DATAOBJ_H
  16. #define _DATAOBJ_H
  17. class CDataObject : public IDataObject, public CComObjectRoot
  18. {
  19. friend class CResultPane;
  20. // ATL Maps
  21. DECLARE_NOT_AGGREGATABLE(CDataObject)
  22. BEGIN_COM_MAP(CDataObject)
  23. COM_INTERFACE_ENTRY(IDataObject)
  24. END_COM_MAP()
  25. // Construction/Destruction
  26. CDataObject() {};
  27. ~CDataObject() {};
  28. // Clipboard formats that are required by the console
  29. public:
  30. static unsigned int m_cfNodeType;
  31. static unsigned int m_cfNodeTypeString;
  32. static unsigned int m_cfDisplayName;
  33. static unsigned int m_cfCoClass;
  34. static unsigned int m_cfInternal;
  35. // Standard IDataObject methods
  36. public:
  37. // Implemented
  38. STDMETHOD(GetData)(LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium);
  39. STDMETHOD(GetDataHere)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium);
  40. STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc);
  41. ULONG InternalAddRef()
  42. {
  43. ++CResultPane::lDataObjectRefCount;
  44. return CComObjectRoot::InternalAddRef();
  45. }
  46. ULONG InternalRelease()
  47. {
  48. --CResultPane::lDataObjectRefCount;
  49. return CComObjectRoot::InternalRelease();
  50. }
  51. // Not Implemented
  52. private:
  53. STDMETHOD(QueryGetData)(LPFORMATETC lpFormatetc)
  54. { return E_NOTIMPL; };
  55. STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
  56. { return E_NOTIMPL; };
  57. STDMETHOD(SetData)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
  58. { return E_NOTIMPL; };
  59. STDMETHOD(DAdvise)(LPFORMATETC lpFormatetc, DWORD advf,
  60. LPADVISESINK pAdvSink, LPDWORD pdwConnection)
  61. { return E_NOTIMPL; };
  62. STDMETHOD(DUnadvise)(DWORD dwConnection)
  63. { return E_NOTIMPL; };
  64. STDMETHOD(EnumDAdvise)(LPENUMSTATDATA* ppEnumAdvise)
  65. { return E_NOTIMPL; };
  66. // Implementation
  67. public:
  68. void SetType(DATA_OBJECT_TYPES type)
  69. { ASSERT(m_internal.m_type == CCT_UNINITIALIZED); m_internal.m_type = type; }
  70. void SetCookie(MMC_COOKIE cookie) { m_internal.m_cookie = cookie; } // Step 3
  71. void SetString(LPTSTR lpString) { m_internal.m_string = lpString; }
  72. void SetID (long ID) { m_internal.m_scopeID = ID; }
  73. private:
  74. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  75. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  76. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  77. HRESULT CreateCoClassID(LPSTGMEDIUM lpMedium);
  78. HRESULT CreateInternal(LPSTGMEDIUM lpMedium);
  79. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  80. INTERNAL m_internal;
  81. };
  82. #endif