MyAbcd.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:3k
- // MyAbcd.h : Declaration of the CMyAbcd
- #ifndef __MYABCD_H_
- #define __MYABCD_H_
- #include "resource.h" // main symbols
- #include <atlctl.h>
- /////////////////////////////////////////////////////////////////////////////
- // CMyAbcd
- class ATL_NO_VTABLE CMyAbcd :
- public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<IMyAbcd, &IID_IMyAbcd, &LIBID_EXEVENTLib>,
- public CComCompositeControl<CMyAbcd>,
- public IPersistStreamInitImpl<CMyAbcd>,
- public IOleControlImpl<CMyAbcd>,
- public IOleObjectImpl<CMyAbcd>,
- public IOleInPlaceActiveObjectImpl<CMyAbcd>,
- public IViewObjectExImpl<CMyAbcd>,
- public IOleInPlaceObjectWindowlessImpl<CMyAbcd>,
- public IConnectionPointContainerImpl<CMyAbcd>,
- public IPersistStorageImpl<CMyAbcd>,
- public ISpecifyPropertyPagesImpl<CMyAbcd>,
- public IQuickActivateImpl<CMyAbcd>,
- public IDataObjectImpl<CMyAbcd>,
- public IProvideClassInfo2Impl<&CLSID_MyAbcd, &DIID__IMyAbcdEvents, &LIBID_EXEVENTLib>,
- public IPropertyNotifySinkCP<CMyAbcd>,
- public CComCoClass<CMyAbcd, &CLSID_MyAbcd>
- {
- public:
- CMyAbcd()
- {
- m_bWindowOnly = TRUE;
- CalcExtent(m_sizeExtent);
- }
- DECLARE_REGISTRY_RESOURCEID(IDR_MYABCD)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- BEGIN_COM_MAP(CMyAbcd)
- COM_INTERFACE_ENTRY(IMyAbcd)
- COM_INTERFACE_ENTRY(IDispatch)
- COM_INTERFACE_ENTRY(IViewObjectEx)
- COM_INTERFACE_ENTRY(IViewObject2)
- COM_INTERFACE_ENTRY(IViewObject)
- COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
- COM_INTERFACE_ENTRY(IOleInPlaceObject)
- COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
- COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
- COM_INTERFACE_ENTRY(IOleControl)
- COM_INTERFACE_ENTRY(IOleObject)
- COM_INTERFACE_ENTRY(IPersistStreamInit)
- COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
- COM_INTERFACE_ENTRY(IConnectionPointContainer)
- COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
- COM_INTERFACE_ENTRY(IQuickActivate)
- COM_INTERFACE_ENTRY(IPersistStorage)
- COM_INTERFACE_ENTRY(IDataObject)
- COM_INTERFACE_ENTRY(IProvideClassInfo)
- COM_INTERFACE_ENTRY(IProvideClassInfo2)
- END_COM_MAP()
- BEGIN_PROP_MAP(CMyAbcd)
- PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
- PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
- // Example entries
- // PROP_ENTRY("Property Description", dispid, clsid)
- // PROP_PAGE(CLSID_StockColorPage)
- END_PROP_MAP()
- BEGIN_CONNECTION_POINT_MAP(CMyAbcd)
- CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
- END_CONNECTION_POINT_MAP()
- BEGIN_MSG_MAP(CMyAbcd)
- CHAIN_MSG_MAP(CComCompositeControl<CMyAbcd>)
- END_MSG_MAP()
- // Handler prototypes:
- // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
- // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
- BEGIN_SINK_MAP(CMyAbcd)
- //Make sure the Event Handlers have __stdcall calling convention
- END_SINK_MAP()
- STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
- {
- if (dispid == DISPID_AMBIENT_BACKCOLOR)
- {
- SetBackgroundColorFromAmbient();
- FireViewChange();
- }
- return IOleControlImpl<CMyAbcd>::OnAmbientPropertyChange(dispid);
- }
- // IViewObjectEx
- DECLARE_VIEW_STATUS(0)
- // IMyAbcd
- public:
- enum { IDD = IDD_MYABCD };
- };
- #endif //__MYABCD_H_