Myabc.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:4k
- // Myabc.h : Declaration of the CMyabc
- #ifndef __MYABC_H_
- #define __MYABC_H_
- #include "resource.h" // main symbols
- #include <atlctl.h>
- #include "exCP.h"
- /////////////////////////////////////////////////////////////////////////////
- // CMyabc
- class ATL_NO_VTABLE CMyabc :
- public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<IMyabc, &IID_IMyabc, &LIBID_EXLib>,
- public CComCompositeControl<CMyabc>,
- public IPersistStreamInitImpl<CMyabc>,
- public IOleControlImpl<CMyabc>,
- public IOleObjectImpl<CMyabc>,
- public IOleInPlaceActiveObjectImpl<CMyabc>,
- public IViewObjectExImpl<CMyabc>,
- public IOleInPlaceObjectWindowlessImpl<CMyabc>,
- public IConnectionPointContainerImpl<CMyabc>,
- public IPersistStorageImpl<CMyabc>,
- public ISpecifyPropertyPagesImpl<CMyabc>,
- public IQuickActivateImpl<CMyabc>,
- public IDataObjectImpl<CMyabc>,
- public IProvideClassInfo2Impl<&CLSID_Myabc, &DIID__IMyabcEvents, &LIBID_EXLib>,
- public IPropertyNotifySinkCP<CMyabc>,
- public CComCoClass<CMyabc, &CLSID_Myabc>,
- public CProxy_IMyabcEvents< CMyabc >
- {
- public:
- CMyabc()
- {
- m_bWindowOnly = TRUE;
- CalcExtent(m_sizeExtent);
- }
- DECLARE_REGISTRY_RESOURCEID(IDR_MYABC)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- BEGIN_COM_MAP(CMyabc)
- COM_INTERFACE_ENTRY(IMyabc)
- 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)
- COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
- END_COM_MAP()
- BEGIN_PROP_MAP(CMyabc)
- 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(CMyabc)
- CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
- CONNECTION_POINT_ENTRY(DIID__IMyabcEvents)
- END_CONNECTION_POINT_MAP()
- BEGIN_MSG_MAP(CMyabc)
- CHAIN_MSG_MAP(CComCompositeControl<CMyabc>)
- COMMAND_HANDLER(IDC_BUTTON1, BN_CLICKED, OnClickedButton1)
- 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(CMyabc)
- //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<CMyabc>::OnAmbientPropertyChange(dispid);
- }
- // IViewObjectEx
- DECLARE_VIEW_STATUS(0)
- // IMyabc
- public:
- enum { IDD = IDD_MYABC };
- LRESULT OnClickedButton1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
- {
- // TODO : Add Code for control notification handler.
- this->Fire_add(::SysAllocString(L"控件制作成功"));
return 0;
- }
- };
- #endif //__MYABC_H_