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.

70 lines
2.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1996 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: dataobj.h
  5. //
  6. // PURPOSE: Defines a simple IDataObject that can be used for basic drag
  7. // and drop scenarios.
  8. //
  9. #ifndef __DATAOBJ__H
  10. #define __DATAOBJ__H
  11. // Class CDataObject
  12. // -----------------
  13. //
  14. // Overview
  15. // This data object provides a simple IDataObject implementation that
  16. // can be used for basic drag and drop. When the caller allocates one
  17. // of these objects, they are responsible for calling HrInitData() to
  18. // tell the object what data it provides and in which formats. Once
  19. // this is provided, the object can be passed to ::DoDragDrop() or put
  20. // on the clipboard.
  21. //
  22. // Notes
  23. // This object assumes that _ALL_ of the data it provides is given to
  24. // it in a memory pointer. The object can however convert that memory
  25. // pointer to either an HGLOBAL or IStream if the caller requests.
  26. //
  27. //
  28. typedef HRESULT (CALLBACK *PFNFREEDATAOBJ)(PDATAOBJINFO pDataObjInfo, DWORD celt);
  29. class CDataObject : public IDataObject
  30. {
  31. public:
  32. // Constructors and Destructor
  33. CDataObject();
  34. ~CDataObject();
  35. // IUnknown Interface members
  36. STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppv);
  37. STDMETHODIMP_(ULONG) AddRef();
  38. STDMETHODIMP_(ULONG) Release();
  39. // IDataObject Interface members
  40. STDMETHODIMP GetData(LPFORMATETC pFE, LPSTGMEDIUM pStgMedium);
  41. STDMETHODIMP GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pStgMedium);
  42. STDMETHODIMP QueryGetData(LPFORMATETC pFE);
  43. STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC pFEIn, LPFORMATETC pFEOut);
  44. STDMETHODIMP SetData(LPFORMATETC pFE, LPSTGMEDIUM pStgMedium,
  45. BOOL fRelease);
  46. STDMETHODIMP EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppEnum);
  47. STDMETHODIMP DAdvise(LPFORMATETC pFE, DWORD advf,
  48. IAdviseSink* ppAdviseSink, LPDWORD pdwConnection);
  49. STDMETHODIMP DUnadvise(DWORD dwConnection);
  50. STDMETHODIMP EnumDAdvise(IEnumSTATDATA** ppEnumAdvise);
  51. // Utility Routines
  52. HRESULT Init(PDATAOBJINFO pDataObjInfo, DWORD celt, PFNFREEDATAOBJ pfnFree);
  53. private:
  54. ULONG m_cRef; // Object reference count
  55. PDATAOBJINFO m_pInfo; // Information we provide
  56. PFNFREEDATAOBJ m_pfnFree; // free funciton for the data object
  57. DWORD m_celtInfo; // Number of elements in m_pInfo
  58. };
  59. OESTDAPI_(HRESULT) CreateDataObject(PDATAOBJINFO pDataObjInfo, DWORD celt, PFNFREEDATAOBJ pfnFree, IDataObject **ppDataObj);
  60. #endif //__DATAOBJ__H