MyPwds.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:4k
- // MyPwds.h : Declaration of the CMyPwds
- #ifndef __MYPWDS_H_
- #define __MYPWDS_H_
- #include "resource.h" // main symbols
- #include <atlctl.h>
- #include "EventCP.h"
- /////////////////////////////////////////////////////////////////////////////
- // CMyPwds
- class ATL_NO_VTABLE CMyPwds :
- public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<IMyPwds, &IID_IMyPwds, &LIBID_EVENTLib>,
- public CComCompositeControl<CMyPwds>,
- public IPersistStreamInitImpl<CMyPwds>,
- public IOleControlImpl<CMyPwds>,
- public IOleObjectImpl<CMyPwds>,
- public IOleInPlaceActiveObjectImpl<CMyPwds>,
- public IViewObjectExImpl<CMyPwds>,
- public IOleInPlaceObjectWindowlessImpl<CMyPwds>,
- public IConnectionPointContainerImpl<CMyPwds>,
- public IPersistStorageImpl<CMyPwds>,
- public ISpecifyPropertyPagesImpl<CMyPwds>,
- public IQuickActivateImpl<CMyPwds>,
- public IDataObjectImpl<CMyPwds>,
- public IProvideClassInfo2Impl<&CLSID_MyPwds, &DIID__IMyPwdsEvents, &LIBID_EVENTLib>,
- public IPropertyNotifySinkCP<CMyPwds>,
- public CComCoClass<CMyPwds, &CLSID_MyPwds>,
- public CProxy_IMyPwdsEvents< CMyPwds >
- {
- public:
- CMyPwds()
- {
- m_bWindowOnly = TRUE;
- CalcExtent(m_sizeExtent);
- }
- DECLARE_REGISTRY_RESOURCEID(IDR_MYPWDS)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- BEGIN_COM_MAP(CMyPwds)
- COM_INTERFACE_ENTRY(IMyPwds)
- 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(CMyPwds)
- 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(CMyPwds)
- CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
- CONNECTION_POINT_ENTRY(DIID__IMyPwdsEvents)
- END_CONNECTION_POINT_MAP()
- BEGIN_MSG_MAP(CMyPwds)
- CHAIN_MSG_MAP(CComCompositeControl<CMyPwds>)
- 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(CMyPwds)
- //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<CMyPwds>::OnAmbientPropertyChange(dispid);
- }
- // IViewObjectEx
- DECLARE_VIEW_STATUS(0)
- // IMyPwds
- public:
- enum { IDD = IDD_MYPWDS };
- 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 //__MYPWDS_H_