DiscFormatData.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ///////////////////////////////////////////////////////////////////////
  2. // DiscFormatData.h
  3. //
  4. // Wrapper for IDiscFormat2Data Interface
  5. //
  6. // Written by Eric Haddan
  7. //
  8. #pragma once
  9. #include "stdafx.h"
  10. #define WM_IMAPI_UPDATE WM_APP+842
  11. typedef struct _IMAPI_STATUS {
  12. // IDiscFormat2DataEventArgs Interface
  13. LONG elapsedTime; // Elapsed time in seconds
  14. LONG remainingTime; // Remaining time in seconds
  15. LONG totalTime; // total estimated time in seconds
  16. // IWriteEngine2EventArgs Interface
  17. LONG startLba; // the starting lba of the current operation
  18. LONG sectorCount; // the total sectors to write in the current operation
  19. LONG lastReadLba; // the last read lba address
  20. LONG lastWrittenLba; // the last written lba address
  21. LONG totalSystemBuffer; // total size of the system buffer
  22. LONG usedSystemBuffer; // size of used system buffer
  23. LONG freeSystemBuffer; // size of the free system buffer
  24. } IMAPI_STATUS, *PIMAPI_STATUS;
  25. #define RETURN_CANCEL_WRITE 0
  26. #define RETURN_CONTINUE 1
  27. class CDiscRecorder;
  28. class CDiscFormatData
  29. {
  30. private:
  31. IDiscFormat2Data* m_discFormatData;
  32. SAFEARRAY* m_mediaTypesArray;
  33. HRESULT m_hResult;
  34. CString m_errorMessage;
  35. // HWND m_hNotificationWnd;
  36. bool m_closeMedia;
  37. public:
  38. CDiscFormatData(void);
  39. ~CDiscFormatData(void);
  40. inline HRESULT GetHresult() {return m_hResult;}
  41. inline CString GetErrorMessage() {return m_errorMessage;}
  42. inline IDiscFormat2Data* GetInterface() {return m_discFormatData;}
  43. bool Initialize(CDiscRecorder* pDiscRecorder, const CString& clientName);
  44. bool Burn(HWND hWnd, IStream* data);
  45. ULONG GetTotalSupportedMediaTypes();
  46. int GetSupportedMediaType(ULONG index);
  47. inline void SetCloseMedia(bool closeMedia){m_closeMedia = closeMedia;}
  48. protected:
  49. IStream* m_streamData;
  50. public:
  51. static CString GetWriteErrorMsg(HRESULT hr);
  52. };