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.

65 lines
1.6 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. //
  3. // class Extractor
  4. //
  5. // 11-12-97 sburns
  6. #ifndef EXTRACT_HPP_INCLUDED
  7. #define EXTRACT_HPP_INCLUDED
  8. // Extractor encapsulates clipboard extraction buffers, allocating and
  9. // initializing them upon construction, deallocating them upon deletion. By
  10. // keeping a single (static) instance of an Extractor around, one can avoid
  11. // allocation/deallocation for each extraction operation, and be assured that
  12. // cleanup occurs properly.
  13. class Extractor
  14. {
  15. protected:
  16. // Creates a new instance. Declared protected so as to function only
  17. // as a base class.
  18. //
  19. // clipFormatID - clipboard format ID returned from Win
  20. // RegisterClipboardFormat.
  21. //
  22. // bufSize - the buffer size, in bytes, required to extract the data in the
  23. // clipboard format expressed by the clipFormatID parameter.
  24. Extractor(CLIPFORMAT clipFormatID, size_t bufSize);
  25. virtual ~Extractor();
  26. // Calls GetDataHere on the data object, returning a pointer to the buffer
  27. // if the call was successful, or 0 if the call failed. The invoker should
  28. // NOT free the returned HGLOBAL, as this is managed by the object.
  29. //
  30. // dataObject - the data object from which the clipboard data should be
  31. // extracted.
  32. HGLOBAL
  33. ExtractData(IDataObject& dataObject);
  34. private:
  35. // not implemented: no copying allowed
  36. Extractor(const Extractor&);
  37. const Extractor& operator=(const Extractor&);
  38. FORMATETC formatetc;
  39. STGMEDIUM stgmedium;
  40. size_t bufSize;
  41. };
  42. #endif // EXTRACT_HPP_INCLUDED