Source code of Windows XP (NT5)
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.

108 lines
3.2 KiB

  1. // VidWndCtrl.h : Declaration of the CContainerControl
  2. #ifndef __CONTAINERCONTROL_H_
  3. #define __CONTAINERCONTROL_H_
  4. #include "resource.h" // main symbols
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CContainerControl
  7. class ATL_NO_VTABLE CContainerControl :
  8. public CComObjectRootEx<CComSingleThreadModel>,
  9. public IDispatchImpl<IContainerControl, &IID_IContainerControl, &LIBID_NmCtl1Lib>,
  10. public CComControl<CContainerControl>,
  11. public IPersistStreamInitImpl<CContainerControl>,
  12. public IPersistPropertyBagImpl<CContainerControl>,
  13. public IOleControlImpl<CContainerControl>,
  14. public IOleObjectImpl<CContainerControl>,
  15. public IOleInPlaceActiveObjectImpl<CContainerControl>,
  16. public IViewObjectExImpl<CContainerControl>,
  17. public IOleInPlaceObjectWindowlessImpl<CContainerControl>,
  18. public ISupportErrorInfo,
  19. public CComCoClass<CContainerControl, &CLSID_ContainerControl>,
  20. public IObjectSafetyImpl<CContainerControl, INTERFACESAFE_FOR_UNTRUSTED_CALLER>
  21. {
  22. private:
  23. CComBSTR m_strProgIDOfControl;
  24. bool m_bInitialized;
  25. public:
  26. CContainerControl()
  27. {
  28. m_bInitialized = false;
  29. m_bWindowOnly = TRUE;
  30. }
  31. virtual HWND CreateControlWindow(HWND hWndParent, RECT& rcPos);
  32. DECLARE_REGISTRY_RESOURCEID(IDR_CONTAINERCONTROL)
  33. DECLARE_NOT_AGGREGATABLE(CContainerControl)
  34. DECLARE_PROTECT_FINAL_CONSTRUCT()
  35. BEGIN_COM_MAP(CContainerControl)
  36. COM_INTERFACE_ENTRY(IContainerControl)
  37. COM_INTERFACE_ENTRY(IDispatch)
  38. COM_INTERFACE_ENTRY(IObjectSafety)
  39. COM_INTERFACE_ENTRY(IViewObjectEx)
  40. COM_INTERFACE_ENTRY(IViewObject2)
  41. COM_INTERFACE_ENTRY(IViewObject)
  42. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  43. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  44. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  45. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  46. COM_INTERFACE_ENTRY(IOleControl)
  47. COM_INTERFACE_ENTRY(IOleObject)
  48. COM_INTERFACE_ENTRY(IPersistStreamInit)
  49. COM_INTERFACE_ENTRY(IPersistPropertyBag)
  50. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  51. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  52. END_COM_MAP()
  53. BEGIN_PROP_MAP(CContainerControl)
  54. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  55. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  56. // Example entries
  57. // PROP_ENTRY("Property Description", dispid, clsid)
  58. // PROP_PAGE(CLSID_StockColorPage)
  59. END_PROP_MAP()
  60. BEGIN_MSG_MAP(CContainerControl)
  61. //CHAIN_MSG_MAP(CComControl<CContainerControl>)
  62. DEFAULT_REFLECTION_HANDLER()
  63. END_MSG_MAP()
  64. // Handler prototypes:
  65. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  66. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  67. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  68. // ISupportsErrorInfo
  69. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
  70. {
  71. static const IID* arr[] =
  72. {
  73. &IID_IContainerControl,
  74. };
  75. for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
  76. {
  77. if (InlineIsEqualGUID(*arr[i], riid))
  78. return S_OK;
  79. }
  80. return S_FALSE;
  81. }
  82. // IViewObjectEx
  83. DECLARE_VIEW_STATUS(0)
  84. // IPersistPropertyBag
  85. STDMETHOD(Load)(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog);
  86. // IContainerControl
  87. STDMETHOD(put_ProgIDOfControl)(IN BSTR strProgIDOfControl );
  88. STDMETHOD(get_ControlDispatch)(OUT LPDISPATCH* ppDisp );
  89. };
  90. #endif //__CONTAINERCONTROL_H_