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.

138 lines
4.2 KiB

  1. // Preview.h : Declaration of the CVideoPreview
  2. #ifndef __VIDEOPREVIEW_H_
  3. #define __VIDEOPREVIEW_H_
  4. #include "resource.h" // main symbols
  5. #include <atlctl.h>
  6. #define PM_CREATEGRAPH (WM_USER+1)
  7. #define PM_GOAWAY (WM_USER+2)
  8. #define TIMER_SHOW_DIALOG 1
  9. #define TIMER_CLOSE_DIALOG 2
  10. typedef struct {
  11. HWND hDlg;
  12. HANDLE hEvent;
  13. } PREVIEW_INFO_STRUCT;
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CVideoPreview
  16. class ATL_NO_VTABLE CVideoPreview :
  17. public CComObjectRootEx<CComSingleThreadModel>,
  18. public CStockPropImpl<CVideoPreview, IVideoPreview, &IID_IVideoPreview, &LIBID_WIAVIEWLib>,
  19. public CComControl<CVideoPreview>,
  20. public IPersistStreamInitImpl<CVideoPreview>,
  21. public IOleControlImpl<CVideoPreview>,
  22. public IOleObjectImpl<CVideoPreview>,
  23. public IOleInPlaceActiveObjectImpl<CVideoPreview>,
  24. public IViewObjectExImpl<CVideoPreview>,
  25. public IOleInPlaceObjectWindowlessImpl<CVideoPreview>,
  26. public IPersistStorageImpl<CVideoPreview>,
  27. public ISpecifyPropertyPagesImpl<CVideoPreview>,
  28. public IQuickActivateImpl<CVideoPreview>,
  29. public IDataObjectImpl<CVideoPreview>,
  30. public IProvideClassInfo2Impl<&CLSID_VideoPreview, NULL, &LIBID_WIAVIEWLib>,
  31. public CComCoClass<CVideoPreview, &CLSID_VideoPreview>
  32. {
  33. public:
  34. CVideoPreview()
  35. {
  36. m_bWindowOnly = TRUE;
  37. m_bAutoSize = FALSE;
  38. //m_bUsingWindowRegion = TRUE;
  39. m_bCreated = FALSE;
  40. WIA_PUSHFUNCTION((TEXT("CVideoPreview::CVideoPreview")));
  41. }
  42. ~CVideoPreview()
  43. {
  44. WIA_PUSHFUNCTION((TEXT("CVideoPreview::~CVideoPreview")));
  45. }
  46. DECLARE_REGISTRY_RESOURCEID(IDR_PREVIEW)
  47. DECLARE_PROTECT_FINAL_CONSTRUCT()
  48. // Mark this interface as safe
  49. BEGIN_CATEGORY_MAP(CVideoPreview)
  50. IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
  51. IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
  52. END_CATEGORY_MAP()
  53. BEGIN_COM_MAP(CVideoPreview)
  54. COM_INTERFACE_ENTRY(IVideoPreview)
  55. COM_INTERFACE_ENTRY(IDispatch)
  56. COM_INTERFACE_ENTRY(IViewObjectEx)
  57. COM_INTERFACE_ENTRY(IViewObject2)
  58. COM_INTERFACE_ENTRY(IViewObject)
  59. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  60. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  61. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  62. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  63. COM_INTERFACE_ENTRY(IOleControl)
  64. COM_INTERFACE_ENTRY(IOleObject)
  65. COM_INTERFACE_ENTRY(IPersistStreamInit)
  66. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  67. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  68. COM_INTERFACE_ENTRY(IQuickActivate)
  69. COM_INTERFACE_ENTRY(IPersistStorage)
  70. COM_INTERFACE_ENTRY(IDataObject)
  71. COM_INTERFACE_ENTRY(IProvideClassInfo)
  72. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  73. END_COM_MAP()
  74. BEGIN_PROP_MAP(CVideoPreview)
  75. PROP_ENTRY("HWND", DISPID_HWND, CLSID_NULL)
  76. // Example entries
  77. // PROP_ENTRY("Property Description", dispid, clsid)
  78. // PROP_PAGE(CLSID_StockColorPage)
  79. END_PROP_MAP()
  80. BEGIN_MSG_MAP(CVideoPreview)
  81. CHAIN_MSG_MAP(CComControl<CVideoPreview>)
  82. MESSAGE_HANDLER(WM_SIZE, OnSize)
  83. MESSAGE_HANDLER(WM_CREATE,OnCreate)
  84. MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
  85. DEFAULT_REFLECTION_HANDLER()
  86. END_MSG_MAP()
  87. // Handler prototypes:
  88. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  89. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  90. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  91. // IViewObjectEx
  92. // DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  93. // IOleInPlaceObject
  94. STDMETHOD(InPlaceDeactivate)();
  95. // IVideoPreview
  96. public:
  97. STDMETHOD(Device)(IUnknown * pDevice);
  98. LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  99. LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  100. LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  101. HRESULT OnDraw(ATL_DRAWINFO& di)
  102. {
  103. return S_OK;
  104. }
  105. private:
  106. CComPtr<IUnknown> m_pDevice;
  107. CComPtr<IWiaVideo> m_pWiaVideo;
  108. BOOL m_bCreated;
  109. };
  110. #endif //__PREVIEW_H_