MOVIECTL.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:4k
源码类别:

Windows编程

开发平台:

Visual C++

  1. // MovieCtl.h : Declaration of the CMovieCtl
  2. //
  3. // This is a part of the Active Template Library.
  4. // Copyright (C) 1996-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Active Template Library Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Active Template Library product.
  12. #ifndef __MOVIECTL_H_
  13. #define __MOVIECTL_H_
  14. #include "resource.h"       // main symbols
  15. // This is the ActiveMovie DLL. You might need to specify an explicit path
  16. // here if the DLL isn't intalled along the PATH or INCLUDE directories on
  17. // your machine.
  18. #import <quartz.dll> no_namespace rename("GUID","_GUID")
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CMovieCtl
  21. class ATL_NO_VTABLE CMovieCtl :
  22. public CComObjectRootEx<CComSingleThreadModel>,
  23. public CComCoClass<CMovieCtl, &CLSID_MovieCtl>,
  24. public IDispatchImpl<IMovieCtl, &IID_IMovieCtl, &LIBID_ATLMOVIELib>,
  25. public CComControl<CMovieCtl>,
  26. public IPersistStreamInitImpl<CMovieCtl>,
  27. public IPersistStorageImpl<CMovieCtl>,
  28. public IOleControlImpl<CMovieCtl>,
  29. public IOleObjectImpl<CMovieCtl>,
  30. public IOleInPlaceActiveObjectImpl<CMovieCtl>,
  31. public IViewObjectExImpl<CMovieCtl>,
  32. public IOleInPlaceObjectWindowlessImpl<CMovieCtl>,
  33. public IProvideClassInfo2Impl<&CLSID_MovieCtl, NULL, &LIBID_ATLMOVIELib>,
  34. public IObjectSafetyImpl<CMovieCtl, INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA>
  35. {
  36. public:
  37. CMovieCtl()
  38. {
  39. }
  40. DECLARE_REGISTRY_RESOURCEID(IDR_MOVIECTL)
  41. BEGIN_COM_MAP(CMovieCtl)
  42. COM_INTERFACE_ENTRY(IMovieCtl)
  43. COM_INTERFACE_ENTRY(IDispatch)
  44. COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
  45. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
  46. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
  47. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
  48. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
  49. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless)
  50. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
  51. COM_INTERFACE_ENTRY_IMPL(IOleControl)
  52. COM_INTERFACE_ENTRY_IMPL(IOleObject)
  53. COM_INTERFACE_ENTRY_IMPL(IPersistStorage)
  54. COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
  55. COM_INTERFACE_ENTRY(IProvideClassInfo)
  56. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  57. COM_INTERFACE_ENTRY(IObjectSafety)
  58. END_COM_MAP()
  59. BEGIN_PROPERTY_MAP(CMovieCtl)
  60. //  PROP_PAGE(CLSID_StockColorPage)
  61. //  PROP_ENTRY("Filename", 2, CLSID_NULL)
  62. END_PROPERTY_MAP()
  63. BEGIN_MSG_MAP(CMovieCtl)
  64. MESSAGE_HANDLER(WM_PAINT, OnPaint)
  65. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  66. MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
  67. END_MSG_MAP()
  68. // IMovieCtl
  69. public:
  70. STDMETHOD(Stop)();
  71. STDMETHOD(Reset)();
  72. STDMETHOD(Pause)();
  73. void FinalRelease()
  74. {
  75. if (m_spVideoWindow)
  76. {
  77. // Hide the video window before we reset the owner
  78. m_spVideoWindow->Visible = FALSE;
  79. m_spVideoWindow->Owner = NULL;
  80. }
  81. }
  82. STDMETHOD(put_FileName)(/*[in]*/ BSTR newVal);
  83. STDMETHOD(Play)();
  84. HRESULT CreateFilterGraph(LPCOLESTR strFile);
  85. HRESULT OnDraw(ATL_DRAWINFO& di);
  86. STDMETHOD(SetObjectRects)(LPCRECT prcPos,LPCRECT prcClip)
  87. {
  88. HRESULT hr = IOleInPlaceObjectWindowlessImpl<CMovieCtl>::SetObjectRects(prcPos, prcClip);
  89. // Resize the video window if we have one
  90. if (m_spVideoWindow)
  91. {
  92. RECT rc = m_rcPos;
  93. if (!m_bWndLess)
  94. OffsetRect(&rc, -rc.left, -rc.top);
  95. m_spVideoWindow->SetWindowPosition(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
  96. }
  97. return hr;
  98. }
  99. protected:
  100. IMediaControlPtr    m_spMediaControl;
  101. IVideoWindowPtr     m_spVideoWindow;
  102. };
  103. #endif //__MOVIECTL_H_