MyPwd.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:3k
- // MyPwd.h : Declaration of the CMyPwd
- #ifndef __MYPWD_H_
- #define __MYPWD_H_
- #include "resource.h" // main symbols
- #include <atlctl.h>
- /////////////////////////////////////////////////////////////////////////////
- // CMyPwd
- class ATL_NO_VTABLE CMyPwd :
- public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<IMyPwd, &IID_IMyPwd, &LIBID_DEMOACTIVEXLib>,
- public CComCompositeControl<CMyPwd>,
- public IPersistStreamInitImpl<CMyPwd>,
- public IOleControlImpl<CMyPwd>,
- public IOleObjectImpl<CMyPwd>,
- public IOleInPlaceActiveObjectImpl<CMyPwd>,
- public IViewObjectExImpl<CMyPwd>,
- public IOleInPlaceObjectWindowlessImpl<CMyPwd>,
- public IPersistStorageImpl<CMyPwd>,
- public ISpecifyPropertyPagesImpl<CMyPwd>,
- public IQuickActivateImpl<CMyPwd>,
- public IDataObjectImpl<CMyPwd>,
- public IProvideClassInfo2Impl<&CLSID_MyPwd, NULL, &LIBID_DEMOACTIVEXLib>,
- public CComCoClass<CMyPwd, &CLSID_MyPwd>
- {
- public:
- CMyPwd()
- {
- m_bWindowOnly = TRUE;
- CalcExtent(m_sizeExtent);
- }
- DECLARE_REGISTRY_RESOURCEID(IDR_MYPWD)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- BEGIN_COM_MAP(CMyPwd)
- COM_INTERFACE_ENTRY(IMyPwd)
- 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(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(CMyPwd)
- 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_MSG_MAP(CMyPwd)
- CHAIN_MSG_MAP(CComCompositeControl<CMyPwd>)
- 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(CMyPwd)
- //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<CMyPwd>::OnAmbientPropertyChange(dispid);
- }
- // IViewObjectEx
- DECLARE_VIEW_STATUS(0)
- // IMyPwd
- public:
- enum { IDD = IDD_MYPWD };
- LRESULT OnClickedButton1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
- {
- // TODO : Add Code for control notification handler.
- AfxMessageBox("Hello");
return 0;
- }
- };
- #endif //__MYPWD_H_